CircosConfigWriter { @NotNull static String cnaAxisPositions(int maxTracks) { StringJoiner builder = new StringJoiner(","); final double rel = 1d / maxTracks; final Function<Integer, String> relString = i -> String.valueOf(Math.round(i * rel * 10000) / 10000d) + "r"; for (int i = 1; i <= Math.min(7, maxTracks); i++) { builder.add(relString.apply(i)); } for (int i = 8; i <= maxTracks; i += 10) { builder.add(relString.apply(i)); } return builder.toString(); } CircosConfigWriter(@NotNull final String sample, @NotNull final String outputDir, @NotNull final CircosData data, @NotNull final SvCircosConfig config); double svTrackRelative(int track); @NotNull String writeConfig(int frame);  }
@Test public void testCnaAxisPositions() { int maxTracks = 42; String positionString = CircosConfigWriter.cnaAxisPositions(maxTracks); StringJoiner copyNumberString = new StringJoiner(","); for (String relativePosition : positionString.split(",")) { long copyNumber = Math.round(maxTracks * Double.valueOf(relativePosition.replace("r", ""))) + 2; copyNumberString.add(String.valueOf(copyNumber)); } assertEquals("3,4,5,6,7,8,9,10,20,30,40", copyNumberString.toString()); }