public static File writePhasingMetrics( final Map<Integer, ? extends Collection<Tile>> laneTiles, final File outputDirectory, final String outputPrefix, final MetricsFile<MetricBase, Comparable<?>> phasingMetricsFile) { laneTiles .entrySet() .stream() .forEach( entry -> IlluminaPhasingMetrics.getPhasingMetricsForTiles( entry.getKey().longValue(), entry.getValue()) .forEach(phasingMetricsFile::addMetric)); return writeMetrics( phasingMetricsFile, outputDirectory, outputPrefix, IlluminaPhasingMetrics.getExtension()); }
/** * Calculate the median phasing & prephasing values for a lane's tiles and create the appropriate * IlluminaPhasingMetrics for them */ public static Collection<IlluminaPhasingMetrics> getPhasingMetricsForTiles( final long lane, final Collection<Tile> tilesForLane) { final LanePhasingMetricsCollector lanePhasingMetricsCollector = new LanePhasingMetricsCollector(tilesForLane); final Collection<IlluminaPhasingMetrics> phasingMetrics = new ArrayList<IlluminaPhasingMetrics>(); for (final TileTemplateRead tileTemplateRead : lanePhasingMetricsCollector.getMedianPhasingMap().keySet()) { final IlluminaPhasingMetrics phasingMetric = new IlluminaPhasingMetrics(); phasingMetric.LANE = lane; phasingMetric.TYPE_NAME = tileTemplateRead.toString(); phasingMetric.PHASING_APPLIED = lanePhasingMetricsCollector.getMedianPhasingMap().get(tileTemplateRead); phasingMetric.PREPHASING_APPLIED = lanePhasingMetricsCollector.getMedianPrePhasingMap().get(tileTemplateRead); phasingMetrics.add(phasingMetric); } return phasingMetrics; }