Search in sources :

Example 1 with PortalFileMetadata

use of org.icgc.dcc.song.importer.model.PortalFileMetadata 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);
}
Also used : lombok.val(lombok.val) SpecimenSampleTuple(org.icgc.dcc.song.importer.convert.SpecimenSampleConverter.SpecimenSampleTuple) PortalFileMetadata(org.icgc.dcc.song.importer.model.PortalFileMetadata) Collectors.toImmutableSet(org.icgc.dcc.common.core.util.stream.Collectors.toImmutableSet) SSLCertificateValidation(org.icgc.dcc.common.core.security.SSLCertificateValidation) File(org.icgc.dcc.song.server.model.entity.File) FILE_CONVERTER(org.icgc.dcc.song.importer.Factory.FILE_CONVERTER) SPECIMEN_SAMPLE_CONVERTER(org.icgc.dcc.song.importer.Factory.SPECIMEN_SAMPLE_CONVERTER) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Autowired(org.springframework.beans.factory.annotation.Autowired) AnalysisConverter.createAnalysisConverter(org.icgc.dcc.song.importer.convert.AnalysisConverter.createAnalysisConverter) PcawgSampleSheetStrategy.createPcawgSampleSheetStrategy(org.icgc.dcc.song.importer.strategies.PcawgSampleSheetStrategy.createPcawgSampleSheetStrategy) DataContainer(org.icgc.dcc.song.importer.model.DataContainer) Factory.buildPersistenceFactory(org.icgc.dcc.song.importer.Factory.buildPersistenceFactory) PcawgSampleSheetConfig(org.icgc.dcc.song.importer.config.PcawgSampleSheetConfig) DONOR_CONVERTER(org.icgc.dcc.song.importer.Factory.DONOR_CONVERTER) lombok.val(lombok.val) Set(java.util.Set) AnalysisConverter(org.icgc.dcc.song.importer.convert.AnalysisConverter) Slf4j(lombok.extern.slf4j.Slf4j) PortalDonorMetadata(org.icgc.dcc.song.importer.model.PortalDonorMetadata) Component(org.springframework.stereotype.Component) List(java.util.List) SAMPLE_SET_CONVERTER(org.icgc.dcc.song.importer.Factory.SAMPLE_SET_CONVERTER) STUDY_CONVERTER(org.icgc.dcc.song.importer.Factory.STUDY_CONVERTER) DATA_CONTAINER_PERSISTENCE_FN(org.icgc.dcc.song.importer.Config.DATA_CONTAINER_PERSISTENCE_FN) SpecimenSampleTuple(org.icgc.dcc.song.importer.convert.SpecimenSampleConverter.SpecimenSampleTuple)

Example 2 with PortalFileMetadata

use of org.icgc.dcc.song.importer.model.PortalFileMetadata in project SONG by overture-stack.

the class DccMetadataFetcher method processDccMetadata.

private Set<File> processDccMetadata(DccMetadata dccMetadata, Map<String, List<PortalFileMetadata>> objectIdMap) {
    val objectId = dccMetadata.getId();
    val portalFileMetadatasForObjectId = objectIdMap.get(objectId);
    val file = simpleDccStorageClient.getFile(objectId, "N/A", dccMetadata.getFileName());
    return portalFileMetadatasForObjectId.stream().map(x -> buildFile(dccMetadata, file, x)).collect(toImmutableSet());
}
Also used : lombok.val(lombok.val) PortalFileMetadata(org.icgc.dcc.song.importer.model.PortalFileMetadata) Collectors.toImmutableSet(org.icgc.dcc.common.core.util.stream.Collectors.toImmutableSet) DccMetadataDao(org.icgc.dcc.song.importer.dao.dcc.DccMetadataDao) File(org.icgc.dcc.song.server.model.entity.File) SneakyThrows(lombok.SneakyThrows) Files(java.nio.file.Files) NonNull(lombok.NonNull) FileConverter.convertToFile(org.icgc.dcc.song.importer.convert.FileConverter.convertToFile) Collection(java.util.Collection) lombok.val(lombok.val) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Set(java.util.Set) DccMetadata(org.icgc.dcc.song.importer.model.DccMetadata) List(java.util.List) CounterMonitor.newMonitor(org.icgc.dcc.song.importer.measurement.CounterMonitor.newMonitor) SimpleDccStorageClient.calcMd5Sum(org.icgc.dcc.song.importer.storage.SimpleDccStorageClient.calcMd5Sum) Map(java.util.Map) DccMetadataConverter(org.icgc.dcc.song.importer.convert.DccMetadataConverter) SimpleDccStorageClient(org.icgc.dcc.song.importer.storage.SimpleDccStorageClient)

Example 3 with PortalFileMetadata

use of org.icgc.dcc.song.importer.model.PortalFileMetadata in project SONG by overture-stack.

the class DccMetadataFetcher method fetchDccMetadataFiles.

public Set<File> fetchDccMetadataFiles(List<PortalFileMetadata> portalFileMetadatas) {
    val objectIdMap = groupDccMetadataIds(portalFileMetadatas);
    val dccMetadatas = dccMetadataDao.findByMultiObjectIds(objectIdMap.keySet());
    val counterMonitor = newMonitor("dccMetadataFiles", 1000);
    counterMonitor.start();
    val set = dccMetadatas.stream().map(x -> processDccMetadata(x, objectIdMap)).map(counterMonitor::streamCollectionCount).flatMap(Collection::stream).collect(toImmutableSet());
    counterMonitor.stop();
    counterMonitor.displaySummary();
    return set;
}
Also used : lombok.val(lombok.val) PortalFileMetadata(org.icgc.dcc.song.importer.model.PortalFileMetadata) Collectors.toImmutableSet(org.icgc.dcc.common.core.util.stream.Collectors.toImmutableSet) DccMetadataDao(org.icgc.dcc.song.importer.dao.dcc.DccMetadataDao) File(org.icgc.dcc.song.server.model.entity.File) SneakyThrows(lombok.SneakyThrows) Files(java.nio.file.Files) NonNull(lombok.NonNull) FileConverter.convertToFile(org.icgc.dcc.song.importer.convert.FileConverter.convertToFile) Collection(java.util.Collection) lombok.val(lombok.val) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Set(java.util.Set) DccMetadata(org.icgc.dcc.song.importer.model.DccMetadata) List(java.util.List) CounterMonitor.newMonitor(org.icgc.dcc.song.importer.measurement.CounterMonitor.newMonitor) SimpleDccStorageClient.calcMd5Sum(org.icgc.dcc.song.importer.storage.SimpleDccStorageClient.calcMd5Sum) Map(java.util.Map) DccMetadataConverter(org.icgc.dcc.song.importer.convert.DccMetadataConverter) SimpleDccStorageClient(org.icgc.dcc.song.importer.storage.SimpleDccStorageClient)

Aggregations

List (java.util.List)3 Set (java.util.Set)3 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)3 lombok.val (lombok.val)3 Collectors.toImmutableSet (org.icgc.dcc.common.core.util.stream.Collectors.toImmutableSet)3 PortalFileMetadata (org.icgc.dcc.song.importer.model.PortalFileMetadata)3 File (org.icgc.dcc.song.server.model.entity.File)3 Files (java.nio.file.Files)2 Collection (java.util.Collection)2 Map (java.util.Map)2 NonNull (lombok.NonNull)2 SneakyThrows (lombok.SneakyThrows)2 DccMetadataConverter (org.icgc.dcc.song.importer.convert.DccMetadataConverter)2 FileConverter.convertToFile (org.icgc.dcc.song.importer.convert.FileConverter.convertToFile)2 DccMetadataDao (org.icgc.dcc.song.importer.dao.dcc.DccMetadataDao)2 CounterMonitor.newMonitor (org.icgc.dcc.song.importer.measurement.CounterMonitor.newMonitor)2 DccMetadata (org.icgc.dcc.song.importer.model.DccMetadata)2 SimpleDccStorageClient (org.icgc.dcc.song.importer.storage.SimpleDccStorageClient)2 SimpleDccStorageClient.calcMd5Sum (org.icgc.dcc.song.importer.storage.SimpleDccStorageClient.calcMd5Sum)2 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1