use of org.icgc.dcc.song.importer.convert.SpecimenSampleConverter.SpecimenSampleTuple in project SONG by overture-stack.
the class Importer method processSpecimensAndSamples.
private void processSpecimensAndSamples(List<PortalFileMetadata> portalFileMetadataList) {
log.info("Converting Specimen and Samples...");
val specimenSampleTuples = SPECIMEN_SAMPLE_CONVERTER.convertSpecimenSampleTuples(portalFileMetadataList);
// Aggregating specimens
val specimens = specimenSampleTuples.stream().collect(groupingBy(SpecimenSampleTuple::getSpecimen)).keySet();
log.info("Updating SpecimenRepository with {} specimens", specimens.size());
specimens.forEach(repositoryDao::createSpecimen);
// Aggregating samples
val samples = specimenSampleTuples.stream().collect(groupingBy(x -> x.getSample().getSampleId())).entrySet().stream().map(// TODO: why??
x -> x.getValue().get(0).getSample()).collect(toImmutableSet());
log.info("Updating SampleRepository with {} samples", samples.size());
samples.forEach(repositoryDao::createSample);
}
Aggregations