use of uk.ac.ebi.spot.goci.curation.exception.FileValidationException in project goci by EBISPOT.
the class DiseaseTraitUploadController method updloadDiseaseTraits.
@PostMapping("/uploads")
public Object updloadDiseaseTraits(@Valid FileUploadRequest fileUploadRequest, BindingResult result) {
if (result.hasErrors()) {
throw new FileValidationException(result);
}
MultipartFile multipartFile = fileUploadRequest.getMultipartFile();
List<DiseaseTrait> diseaseTraits = DiseaseTraitDtoAssembler.disassemble(multipartFile);
diseaseTraits = diseaseTraitService.createDiseaseTraits(diseaseTraits);
log.info("{} {} were created", diseaseTraits.size(), EntityType.DISEASE_TRAIT);
return new ResponseEntity<>(DiseaseTraitDtoAssembler.assemble(diseaseTraits), HttpStatus.CREATED);
}
use of uk.ac.ebi.spot.goci.curation.exception.FileValidationException in project goci by EBISPOT.
the class StudyRestController method multiUploadFileModel.
@PostMapping(Endpoint.STUDIES)
public Object multiUploadFileModel(@Valid FileUploadRequest fileUploadRequest, BindingResult result) {
if (result.hasErrors()) {
throw new FileValidationException(result);
}
List<StudyPatchRequest> studyPatchRequests = FileHandler.getStudyPatchRequests(fileUploadRequest);
List<Study> updatedStudies = new ArrayList<>();
for (StudyPatchRequest request : studyPatchRequests) {
log.info("Dataset with GCST {} and Curated Trait {} was loaded from file", request.getGcst(), request.getCuratedReportedTrait());
String gcst = request.getGcst().trim();
String curatedReportedTrait = request.getCuratedReportedTrait().trim();
updatedStudies.add(studyDataService.updateStudyDiseaseTraitByAccessionId(curatedReportedTrait, gcst));
}
return new ResponseEntity<>(updatedStudies, HttpStatus.OK);
}
use of uk.ac.ebi.spot.goci.curation.exception.FileValidationException in project goci by EBISPOT.
the class DiseaseTraitUploadController method similaritySearchAnalysis.
@PostMapping("/analysis")
public AnalysisCacheDto similaritySearchAnalysis(@Valid FileUploadRequest fileUploadRequest, BindingResult result) {
if (result.hasErrors()) {
throw new FileValidationException(result);
}
List<AnalysisDTO> analysisDTO = FileHandler.serializeDiseaseTraitAnalysisFile(fileUploadRequest);
log.info("{} disease traits were ingested for analysis", analysisDTO.size());
String analysisId = UUID.randomUUID().toString();
AnalysisCacheDto analysisCacheDto = diseaseTraitService.similaritySearch(analysisDTO, analysisId, 50.0);
log.info("Analysis done, retrievable in future with id {}", analysisId);
return analysisCacheDto;
}
Aggregations