Source:
<code>public void mergeSimilarSegments(final double sigmaThresholdSegmentMean, final double sigmaThresholdMinorAlleleFraction, final int numSamplesCopyRatio, final int numBurnInCopyRatio, final int numSamplesAlleleFraction, final int numBurnInAlleleFraction) { logger.info("Starting similar-segment merging..."); logger.info("Initial number of segments: " + segments.size()); List<ACSModeledSegment> mergedSegments = new ArrayList<>(segments); final File initialModeledSegmentsFile = new File(outputPrefix + "-" + INITIAL_SEG_FILE_TAG + ".seg"); SegmentUtils.writeACSModeledSegmentFile(initialModeledSegmentsFile, mergedSegments, segmentedModel.getGenome()); int numIterations = 1; int prevNumSegments; <START> while (numIterations <= MAX_SIMILAR_SEGMENT_MERGE_ITERATIONS) { <END> logger.info("Similar-segment merging iteration: " + numIterations); logger.info("Number of segments before merging: " + mergedSegments.size()); prevNumSegments = mergedSegments.size(); mergedSegments = SegmentMergeUtils.mergeSimilarSegments(segments, sigmaThresholdSegmentMean, sigmaThresholdMinorAlleleFraction); logger.info("Number of segments after merging: " + mergedSegments.size()); segmentedModel = new SegmentedModel(toUnmodeledSegments(mergedSegments), segmentedModel.getGenome()); if (mergedSegments.size() == prevNumSegments) { break; } fitModel(numSamplesCopyRatio, numBurnInCopyRatio, numSamplesAlleleFraction, numBurnInAlleleFraction); final File modeledSegmentsFile = new File(outputPrefix + "-" + INTERMEDIATE_SEG_FILE_TAG + "-" + numIterations + ".seg"); SegmentUtils.writeACSModeledSegmentFile(modeledSegmentsFile, segments, segmentedModel.getGenome()); numIterations++; } fitModel(this.numSamplesCopyRatio, this.numBurnInCopyRatio, this.numSamplesAlleleFraction, this.numBurnInAlleleFraction); final File finalModeledSegmentsFile = new File(outputPrefix + "-" + FINAL_SEG_FILE_TAG + ".seg"); SegmentUtils.writeACSModeledSegmentFile(finalModeledSegmentsFile, segments, segmentedModel.getGenome()); }</code><technical_language>This a for loop</technical_language>

Target:
public void mergeSimilarSegments(final double sigmaThresholdSegmentMean, final double sigmaThresholdMinorAlleleFraction, final int numSamplesCopyRatio, final int numBurnInCopyRatio, final int numSamplesAlleleFraction, final int numBurnInAlleleFraction) { logger.info("Starting similar-segment merging..."); logger.info("Initial number of segments: " + segments.size()); List<ACSModeledSegment> mergedSegments = new ArrayList<>(segments); final File initialModeledSegmentsFile = new File(outputPrefix + "-" + INITIAL_SEG_FILE_TAG + ".seg"); SegmentUtils.writeACSModeledSegmentFile(initialModeledSegmentsFile, mergedSegments, segmentedModel.getGenome()); int prevNumSegments; for (int numIterations = 1; numIterations <= MAX_SIMILAR_SEGMENT_MERGE_ITERATIONS; numIterations++) { logger.info("Similar-segment merging iteration: " + numIterations); logger.info("Number of segments before merging: " + mergedSegments.size()); prevNumSegments = mergedSegments.size(); mergedSegments = SegmentMergeUtils.mergeSimilarSegments(segments, sigmaThresholdSegmentMean, sigmaThresholdMinorAlleleFraction); logger.info("Number of segments after merging: " + mergedSegments.size()); segmentedModel = new SegmentedModel(toUnmodeledSegments(mergedSegments), segmentedModel.getGenome()); if (mergedSegments.size() == prevNumSegments) { break; } fitModel(numSamplesCopyRatio, numBurnInCopyRatio, numSamplesAlleleFraction, numBurnInAlleleFraction); final File modeledSegmentsFile = new File(outputPrefix + "-" + INTERMEDIATE_SEG_FILE_TAG + "-" + numIterations + ".seg"); SegmentUtils.writeACSModeledSegmentFile(modeledSegmentsFile, segments, segmentedModel.getGenome()); } fitModel(this.numSamplesCopyRatio, this.numBurnInCopyRatio, this.numSamplesAlleleFraction, this.numBurnInAlleleFraction); final File finalModeledSegmentsFile = new File(outputPrefix + "-" + FINAL_SEG_FILE_TAG + ".seg"); SegmentUtils.writeACSModeledSegmentFile(finalModeledSegmentsFile, segments, segmentedModel.getGenome()); }