Search in sources :

Example 1 with DepositionAssociationDto

use of uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto in project goci by EBISPOT.

the class DepositionUtil method getSubmissionType.

public static Submission.SubmissionType getSubmissionType(DepositionSubmission submission) {
    if (submission.getBodyOfWork() != null && submission.getPublication() == null) {
        return Submission.SubmissionType.PRE_PUBLISHED;
    } else if (submission.getBodyOfWork() == null && submission.getPublication() == null) {
        return Submission.SubmissionType.UNKNOWN;
    } else if (submission.getPublication() != null) {
        String publicationStatus = submission.getPublication().getStatus();
        boolean hasSumStats = false;
        boolean hasMetadata = false;
        boolean hasAssociations = false;
        if (publicationStatus.equals("UNDER_SUBMISSION")) {
            hasMetadata = true;
        } else if (publicationStatus.equals("UNDER_SUMMARY_STATS_SUBMISSION")) {
            hasSumStats = true;
        }
        if (submission.getStudies() != null) {
            for (DepositionStudyDto studyDto : submission.getStudies()) {
                if (studyDto.getSummaryStatisticsFile() != null && !studyDto.getSummaryStatisticsFile().equals("") && !studyDto.getSummaryStatisticsFile().equals("NR")) {
                    hasSumStats = true;
                }
            }
        }
        if (submission.getAssociations() != null) {
            for (DepositionAssociationDto associationDto : submission.getAssociations()) {
                if (associationDto.getStudyTag() != null) {
                    hasAssociations = true;
                }
            }
        }
        if (hasMetadata && hasSumStats && hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_SUM_STATS_AND_TOP_ASSOCIATIONS;
        }
        if (hasMetadata && hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_SUM_STATS;
        }
        if (hasMetadata && !hasSumStats && hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_TOP_ASSOCIATIONS;
        }
        if (hasMetadata && !hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.METADATA;
        }
        if (!hasMetadata && hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.SUM_STATS;
        }
    }
    return Submission.SubmissionType.UNKNOWN;
}
Also used : DepositionAssociationDto(uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto) DepositionStudyDto(uk.ac.ebi.spot.goci.model.deposition.DepositionStudyDto)

Example 2 with DepositionAssociationDto

use of uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto in project goci by EBISPOT.

the class DepositionAssociationService method saveAssociations.

@Transactional
public String saveAssociations(SecureUser currentUser, String studyTag, Study study, List<DepositionAssociationDto> associations, List<EfoTrait> efoTraits, ImportLog importLog) {
    // find associations in study
    String eRelease = ensemblRestTemplateService.getRelease();
    StringBuffer studyNote = new StringBuffer();
    for (DepositionAssociationDto associationDto : associations) {
        if (associationDto.getStudyTag().equals(studyTag)) {
            getLog().info("Creating association: {} | {}", study.getStudyTag(), study.getAccessionId());
            ImportLogStep importStep = importLog.addStep(new ImportLogStep("Creating association", study.getAccessionId()));
            Association association = new Association();
            association.setSnpInteraction(false);
            Collection<Locus> loci = new ArrayList<>();
            Locus locus = new Locus();
            association.setMultiSnpHaplotype(false);
            association.setSnpType("novel");
            locus.setDescription("Single variant");
            if (associationDto.getStandardError() != null) {
                association.setStandardError(associationDto.getStandardError().floatValue());
            }
            String pValue = associationDto.getPValue();
            if (pValue != null && pValue.toLowerCase().contains("e")) {
                String[] pValues = pValue.toLowerCase().split("e");
                int exponent = Integer.valueOf(pValues[1]);
                int mantissa = (int) Math.round(Double.valueOf(pValues[0]));
                if (mantissa == 10) {
                    mantissa = 1;
                    exponent = exponent + 1;
                }
                association.setPvalueExponent(exponent);
                association.setPvalueMantissa(mantissa);
            }
            association.setPvalueDescription(associationDto.getPValueText());
            String rsID = associationDto.getVariantID();
            getLog().info("[IMPORT] Processing rdID: {}", rsID);
            if (StringUtils.isNotBlank(rsID)) {
                SingleNucleotidePolymorphism snp = lociService.createSnp(rsID);
                // does this fail
                studyNote.append("added SNP " + rsID + "\n");
                RiskAllele riskAllele = lociService.createRiskAllele(rsID + "-" + associationDto.getEffectAllele(), snp);
                getLog().info("[IMPORT] Risk allele created: {}", riskAllele.getId());
                if (StringUtils.isNotBlank(associationDto.getProxyVariant())) {
                    List<SingleNucleotidePolymorphism> proxySnps = new ArrayList<>();
                    proxySnps.add(lociService.createSnp(associationDto.getProxyVariant()));
                    riskAllele.setProxySnps(proxySnps);
                }
                List<RiskAllele> alleleList = new ArrayList<>();
                alleleList.add(riskAllele);
                locus.setStrongestRiskAlleles(alleleList);
                loci.add(locus);
                association.setLoci(loci);
            } else {
                importLog.addError("No rsId provided.", "Creating association");
                importLog.updateStatus(importStep.getId(), ImportLog.FAIL);
                continue;
            }
            if (associationDto.getEffectAlleleFrequency() != null && associationDto.getEffectAlleleFrequency().intValue() != -1) {
                association.setRiskFrequency(associationDto.getEffectAlleleFrequency().toString());
            } else {
                association.setRiskFrequency("NR");
            }
            if (associationDto.getStandardError() != null) {
                association.setStandardError(associationDto.getStandardError().floatValue());
            }
            if (associationDto.getOddsRatio() != null) {
                association.setOrPerCopyNum(associationDto.getOddsRatio().floatValue());
            }
            if (associationDto.getBeta() != null) {
                Double betaValue = associationDto.getBeta();
                if (betaValue < 0) {
                    association.setBetaDirection("decrease");
                } else {
                    association.setBetaDirection("increase");
                }
                association.setBetaNum(Math.abs(betaValue.floatValue()));
                association.setBetaUnit(associationDto.getBetaUnit());
            }
            if (associationDto.getCiLower() != null && associationDto.getCiUpper() != null) {
                association.setRange("[" + associationDto.getCiLower() + "-" + associationDto.getCiUpper() + "]");
            } else {
                if (associationDto.getOddsRatio() != null && associationDto.getStandardError() != null) {
                    association.setRange(calculationService.setRange(associationDto.getStandardError(), Math.abs(associationDto.getOddsRatio())));
                } else if (associationDto.getBeta() != null && associationDto.getStandardError() != null) {
                    association.setRange(calculationService.setRange(associationDto.getStandardError(), Math.abs(associationDto.getBeta())));
                }
            }
            AssociationExtension associationExtension = new AssociationExtension();
            associationExtension.setAssociation(association);
            associationExtension.setEffectAllele(associationDto.getEffectAllele());
            if (StringUtils.isNotBlank(associationDto.getOtherAllele())) {
                associationExtension.setOtherAllele(associationDto.getOtherAllele());
            }
            if (efoTraits != null) {
                association.setEfoTraits(efoTraits);
            }
            associationOperationsService.saveAssociation(association, study, new ArrayList<>());
            extensionRepository.save(associationExtension);
            association.setAssociationExtension(associationExtension);
            associationRepository.save(association);
            Collection<AssociationValidationView> errors = associationOperationsService.saveAssociationCreatedFromForm(study, association, currentUser, eRelease);
            getLog().info("Found {} errors on save.", errors.size());
            StringBuffer errorBuffer = new StringBuffer();
            for (AssociationValidationView associationValidationView : errors) {
                getLog().error("Save error: {} | {} | {}", associationValidationView.getWarning(), associationValidationView.getErrorMessage(), associationValidationView.getField());
                errorBuffer.append("Save error: " + associationValidationView.getWarning() + " | " + associationValidationView.getErrorMessage() + " | " + associationValidationView.getField()).append("\n");
            }
            if (!errors.isEmpty()) {
                importLog.addWarning(errorBuffer.toString().trim(), "Creating association");
            }
            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
        }
    }
    return studyNote.toString();
}
Also used : AssociationValidationView(uk.ac.ebi.spot.goci.curation.model.AssociationValidationView) DepositionAssociationDto(uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto) ArrayList(java.util.ArrayList) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with DepositionAssociationDto

use of uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto in project goci by EBISPOT.

the class DepositionSubmissionImportService method importSubmission.

@Async
@Transactional
public void importSubmission(DepositionSubmission depositionSubmission, SecureUser currentUser, Long submissionImportId) {
    ImportLog importLog = new ImportLog();
    getLog().info("Evaluating submission type for: {}", depositionSubmission.getSubmissionId());
    Submission.SubmissionType submissionType = DepositionUtil.getSubmissionType(depositionSubmission);
    getLog().info("Found submission type for: {}", submissionType.name());
    Curator curator = curatorRepository.findByEmail(currentUser.getEmail());
    String submissionID = depositionSubmission.getSubmissionId();
    getLog().info("[{}] Retrieving publication: {}", submissionID, depositionSubmission.getPublication().getPmid());
    Publication publication = publicationService.findByPumedId(depositionSubmission.getPublication().getPmid());
    getLog().info("[{}] Found publication: {}", submissionID, publication.getPubmedId());
    getLog().info("[{}] Looking for studies in the local DB ...", submissionID);
    Collection<Study> dbStudies = studyService.findByPublication(depositionSubmission.getPublication().getPmid());
    List<Long> dbStudyIds = dbStudies.stream().map(Study::getId).collect(Collectors.toList());
    getLog().info("[{}] Found {} studies: {}", submissionID, dbStudies.size(), dbStudyIds);
    List<DepositionStudyDto> studies = depositionSubmission.getStudies();
    List<String> gcsts = studies.stream().map(DepositionStudyDto::getAccession).collect(Collectors.toList());
    getLog().info("[{}] Found {} studies in the submission retrieved from the Deposition App: {}", submissionID, studies.size(), gcsts);
    boolean outcome = true;
    if (submissionType == Submission.SubmissionType.SUM_STATS) {
        // if submission type is SUM_STATS only
        getLog().info("[{}] Found SUM_STATS submission.", submissionID, studies.size());
        ImportLogStep importStep = importLog.addStep(new ImportLogStep("Publishing summary stats", submissionID));
        Pair<Boolean, List<String>> result = depositionStudyService.publishSummaryStats(studies, dbStudies);
        if (result.getLeft()) {
            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
            importLog.addErrors(result.getRight(), "Publishing summary stats");
            importStep = importLog.addStep(new ImportLogStep("Updating submission status: CURATION_COMPLETE", submissionID));
            String stepOutcome = ingestService.updateSubmissionStatus(depositionSubmission, "CURATION_COMPLETE", "PUBLISHED_WITH_SS");
            if (stepOutcome != null) {
                importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS_WITH_WARNINGS);
                importLog.addWarning(stepOutcome, "Updating submission status: CURATION_COMPLETE");
            } else {
                importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
            }
        } else {
            importLog.updateStatus(importStep.getId(), ImportLog.FAIL);
            importLog.addErrors(result.getRight(), "Publishing summary stats");
            outcome = false;
        }
    } else {
        ImportLogStep studiesStep = importLog.addStep(new ImportLogStep("Verifying studies", submissionID));
        if (studies != null) {
            // && dbStudies.size() == 1) { //only do this for un-curated publications
            importLog.updateStatus(studiesStep.getId(), ImportLog.SUCCESS);
            getLog().info("[{}] Validating associations ...", submissionID);
            ImportLogStep importStep = importLog.addStep(new ImportLogStep("Validating associations", submissionID));
            for (DepositionStudyDto studyDto : studies) {
                List<DepositionAssociationDto> associations = depositionSubmission.getAssociations();
                if (associations != null) {
                    List<String> errors = associationValidationService.validateAssociations(studyDto.getStudyTag(), studyDto.getAccession(), associations);
                    importLog.addWarnings(errors, "Validating associations");
                }
            }
            getLog().info("[{}] Associations validated. Found {} errors and {} warnings.", submissionID, importLog.getErrorList().size(), importLog.getWarnings().size());
            if (!importLog.getErrorList().isEmpty()) {
                importLog.updateStatus(importStep.getId(), ImportLog.FAIL);
                outcome = false;
            } else {
                importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
                getLog().info("[{}] Deleting proxy studies created when the publication was initially imported.", submissionID);
                importStep = importLog.addStep(new ImportLogStep("Deleting proxy studies", submissionID));
                String result = depositionStudyService.deleteStudies(dbStudies, curator, currentUser);
                if (result != null) {
                    importLog.addError(result, "Deleting proxy studies");
                    importLog.updateStatus(importStep.getId(), ImportLog.FAIL);
                    outcome = false;
                } else {
                    importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
                }
                if (outcome) {
                    outcome = studiesProcessingService.processStudies(depositionSubmission, currentUser, publication, curator, importLog);
                    if (outcome) {
                        getLog().info("[{}] Deleting unpublished studies and body of works.", submissionID);
                        importStep = importLog.addStep(new ImportLogStep("Deleting unpublished data", submissionID));
                        result = cleanupPrePublishedStudies(studies);
                        if (result != null) {
                            importLog.addWarning(result, "Deleting unpublished data");
                            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS_WITH_WARNINGS);
                        } else {
                            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
                        }
                        importStep = importLog.addStep(new ImportLogStep("Updating submission status: CURATION_COMPLETE", submissionID));
                        result = ingestService.updateSubmissionStatus(depositionSubmission, "CURATION_COMPLETE", "CURATION_STARTED");
                        if (result != null) {
                            importLog.addWarning(result, "Updating submission status: CURATION_COMPLETE");
                            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS_WITH_WARNINGS);
                        } else {
                            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
                        }
                    }
                }
            }
        } else {
            importLog.updateStatus(studiesStep.getId(), ImportLog.FAIL);
            importLog.addError("Submission [" + submissionID + "] has no studies", "Verifying studies");
            outcome = false;
        }
    }
    if (outcome) {
        if (depositionSubmission.getPublication().getCorrespondingAuthor() != null) {
            getLog().info("Creating Publication extensions for corresponding authors ...");
            PublicationExtension author = new PublicationExtension();
            author.setCorrespondingAuthorEmail(depositionSubmission.getPublication().getCorrespondingAuthor().getEmail());
            if (depositionSubmission.getPublication().getCorrespondingAuthor().getGroup() != null) {
                author.setCorrespondingAuthorName(depositionSubmission.getPublication().getCorrespondingAuthor().getGroup());
            } else {
                author.setCorrespondingAuthorName(depositionSubmission.getPublication().getCorrespondingAuthor().getFirstName() + ' ' + depositionSubmission.getPublication().getCorrespondingAuthor().getLastName());
            }
            publicationExtensionRepository.save(author);
            getLog().info("Publication extension created: {}", author.getId());
            List<PublicationExtension> authorList = new ArrayList<>();
            authorList.add(author);
            publication.setCorrespondingAuthors(authorList);
            publicationService.save(publication);
            getLog().info("Publication [{}] saved.", publication.getPubmedId());
        }
    } else {
        ImportLogStep importStep = importLog.addStep(new ImportLogStep("Updating submission status: IMPORT_FAILED", submissionID));
        String stepOutcome = ingestService.updateSubmissionStatus(depositionSubmission, "IMPORT_FAILED", "");
        if (stepOutcome != null) {
            importLog.updateStatus(importStep.getId(), ImportLog.FAIL);
            importLog.addError(stepOutcome, "Updating submission status: IMPORT_FAILED");
        } else {
            importLog.updateStatus(importStep.getId(), ImportLog.SUCCESS);
        }
    }
    mailService.sendSubmissionImportNotification(outcome, depositionSubmission.getPublication().getPmid(), submissionID, importLog, currentUser.getEmail());
    getLog().info("Import process finalized: {}", depositionSubmission.getSubmissionId());
    getLog().info(importLog.pretty(false));
    submissionImportProgressService.deleteImport(submissionImportId);
}
Also used : Submission(uk.ac.ebi.spot.goci.model.deposition.Submission) DepositionSubmission(uk.ac.ebi.spot.goci.model.deposition.DepositionSubmission) DepositionAssociationDto(uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto) DepositionStudyDto(uk.ac.ebi.spot.goci.model.deposition.DepositionStudyDto) Async(org.springframework.scheduling.annotation.Async) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DepositionAssociationDto

use of uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto in project goci by EBISPOT.

the class DepositionUtil method getSubmissionType.

public static Submission.SubmissionType getSubmissionType(DepositionSubmission submission) {
    if (submission.getBodyOfWork() != null && submission.getPublication() == null) {
        return Submission.SubmissionType.PRE_PUBLISHED;
    } else if (submission.getBodyOfWork() == null && submission.getPublication() == null) {
        return Submission.SubmissionType.UNKNOWN;
    } else if (submission.getPublication() != null) {
        String publicationStatus = submission.getPublication().getStatus();
        boolean hasSumStats = false;
        boolean hasMetadata = false;
        boolean hasAssociations = false;
        if (publicationStatus.equals("UNDER_SUBMISSION")) {
            hasMetadata = true;
        } else if (publicationStatus.equals("UNDER_SUMMARY_STATS_SUBMISSION")) {
            hasSumStats = true;
        }
        if (submission.getStudies() != null) {
            for (DepositionStudyDto studyDto : submission.getStudies()) {
                if (studyDto.getSummaryStatisticsFile() != null && !studyDto.getSummaryStatisticsFile().equals("") && !studyDto.getSummaryStatisticsFile().equals("NR")) {
                    hasSumStats = true;
                }
            }
        }
        if (submission.getAssociations() != null) {
            for (DepositionAssociationDto associationDto : submission.getAssociations()) {
                if (associationDto.getStudyTag() != null) {
                    hasAssociations = true;
                }
            }
        }
        if (hasMetadata && hasSumStats && hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_SUM_STATS_AND_TOP_ASSOCIATIONS;
        }
        if (hasMetadata && hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_SUM_STATS;
        }
        if (hasMetadata && !hasSumStats && hasAssociations) {
            return Submission.SubmissionType.METADATA_AND_TOP_ASSOCIATIONS;
        }
        if (hasMetadata && !hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.METADATA;
        }
        if (!hasMetadata && hasSumStats && !hasAssociations) {
            return Submission.SubmissionType.SUM_STATS;
        }
    }
    return Submission.SubmissionType.UNKNOWN;
}
Also used : DepositionAssociationDto(uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto) DepositionStudyDto(uk.ac.ebi.spot.goci.model.deposition.DepositionStudyDto)

Example 5 with DepositionAssociationDto

use of uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto in project goci by EBISPOT.

the class AssociationValidationService method validateAssociations.

public List<String> validateAssociations(String studyTag, String accessionId, List<DepositionAssociationDto> associations) {
    List<String> errorList = new ArrayList<>();
    // find associations in study
    String eRelease = ensemblRestTemplateService.getRelease();
    for (DepositionAssociationDto associationDto : associations) {
        if (associationDto.getStudyTag().equals(studyTag)) {
            Association association = new Association();
            association.setSnpInteraction(false);
            Collection<Locus> loci = new ArrayList<>();
            Locus locus = new Locus();
            association.setMultiSnpHaplotype(false);
            association.setSnpType("novel");
            locus.setDescription("Single variant");
            if (associationDto.getStandardError() != null) {
                association.setStandardError(associationDto.getStandardError().floatValue());
            }
            String pValue = associationDto.getPValue();
            if (pValue != null && pValue.toLowerCase().contains("e")) {
                String[] pValues = pValue.toLowerCase().split("e");
                int exponent = Integer.valueOf(pValues[1]);
                int mantissa = (int) Math.round(Double.valueOf(pValues[0]));
                if (mantissa == 10) {
                    mantissa = 1;
                    exponent = exponent + 1;
                }
                association.setPvalueExponent(exponent);
                association.setPvalueMantissa(mantissa);
            }
            association.setPvalueDescription(associationDto.getPValueText());
            String rsID = associationDto.getVariantID();
            getLog().info("Processing rdID: {}", studyTag, accessionId, rsID);
            if (rsID != null) {
                SingleNucleotidePolymorphism snp = lociService.createSnp(rsID);
                RiskAllele riskAllele = lociService.createRiskAllele(rsID + "-" + associationDto.getEffectAllele(), snp);
                if (associationDto.getProxyVariant() != null) {
                    List<SingleNucleotidePolymorphism> proxySnps = new ArrayList<>();
                    proxySnps.add(lociService.createSnp(associationDto.getProxyVariant()));
                    riskAllele.setProxySnps(proxySnps);
                }
                List<RiskAllele> alleleList = new ArrayList<>();
                alleleList.add(riskAllele);
                locus.setStrongestRiskAlleles(alleleList);
                loci.add(locus);
                association.setLoci(loci);
            } else {
                errorList.add("No rsId found for association related to: " + associationDto.getStudyTag() + " | " + accessionId);
                continue;
            }
            if (associationDto.getEffectAlleleFrequency() != null && associationDto.getEffectAlleleFrequency().intValue() != -1) {
                association.setRiskFrequency(associationDto.getEffectAlleleFrequency().toString());
            } else {
                association.setRiskFrequency("NR");
            }
            if (associationDto.getStandardError() != null) {
                association.setStandardError(associationDto.getStandardError().floatValue());
            }
            String measurementType = "";
            if (associationDto.getOddsRatio() != null) {
                association.setOrPerCopyNum(associationDto.getOddsRatio().floatValue());
                measurementType = "or";
            }
            if (associationDto.getBeta() != null) {
                Double betaValue = associationDto.getBeta();
                if (betaValue < 0) {
                    association.setBetaDirection("decrease");
                } else {
                    association.setBetaDirection("increase");
                }
                association.setBetaNum(Math.abs(betaValue.floatValue()));
                measurementType = "beta";
                association.setBetaUnit(associationDto.getBetaUnit());
            }
            if (associationDto.getCiLower() != null && associationDto.getCiUpper() != null) {
                association.setRange("[" + associationDto.getCiLower() + "-" + associationDto.getCiUpper() + "]");
            } else {
                if (associationDto.getOddsRatio() != null && associationDto.getStandardError() != null) {
                    association.setRange(calculationService.setRange(associationDto.getStandardError(), Math.abs(associationDto.getOddsRatio())));
                    measurementType = "or";
                } else if (associationDto.getBeta() != null && associationDto.getStandardError() != null) {
                    association.setRange(calculationService.setRange(associationDto.getStandardError(), Math.abs(associationDto.getBeta())));
                    measurementType = "beta";
                }
            }
            AssociationExtension associationExtension = new AssociationExtension();
            associationExtension.setAssociation(association);
            associationExtension.setEffectAllele(associationDto.getEffectAllele());
            associationExtension.setOtherAllele(associationDto.getOtherAllele());
            getLog().info("[{} | {}] Checking for SNP validation errors ...", studyTag, accessionId);
            Collection<ValidationError> rowErrors = associationOperationsService.checkSnpAssociationErrors(association, measurementType);
            getLog().info("[{} | {}] Found {} SNP validation errors.", studyTag, accessionId, rowErrors.size());
            for (ValidationError validationError : rowErrors) {
                getLog().error("SNP validation error: {} | {} | {} | {}", validationError.getField(), validationError.getTypeError(), validationError.getError(), validationError.getWarning());
                errorList.add("[" + accessionId + " | " + associationDto.getStudyTag() + "] SNP validation error: " + validationError.getField() + " [" + validationError.getTypeError() + "]: " + validationError.getError() + " | " + validationError.getWarning());
            }
            if (rowErrors.isEmpty()) {
                // Save and validate form
                // Validate association
                getLog().info("[{} | {}] Performing full validation ...", studyTag, accessionId);
                Collection<ValidationError> associationValidationErrors = validationService.runAssociationValidation(association, "full", eRelease);
                getLog().info("[{} | {}] Found {} full validation errors.", studyTag, accessionId, associationValidationErrors.size());
                for (ValidationError validationError : associationValidationErrors) {
                    getLog().error("Full validation error: {} | {} | {} | {}", validationError.getField(), validationError.getTypeError(), validationError.getError(), validationError.getWarning());
                    errorList.add("[" + accessionId + " | " + associationDto.getStudyTag() + "] Full validation error: " + validationError.getField() + " [" + validationError.getTypeError() + "]: " + validationError.getError() + " | " + validationError.getWarning());
                }
            /* if (!associationValidationErrors.isEmpty()) {
                        continue;
                    }

                    List<String> list = mapCatalogService.validateMappingForAssociation(association, rsID);
                    for (String error : list) {
                        errorList.add("[" + accessionId + " | " + associationDto.getStudyTag() + "] :: " + error);
                    } */
            }
        }
    }
    return errorList;
}
Also used : DepositionAssociationDto(uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto) ArrayList(java.util.ArrayList)

Aggregations

DepositionAssociationDto (uk.ac.ebi.spot.goci.model.deposition.DepositionAssociationDto)5 DepositionStudyDto (uk.ac.ebi.spot.goci.model.deposition.DepositionStudyDto)3 ArrayList (java.util.ArrayList)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Async (org.springframework.scheduling.annotation.Async)1 AssociationValidationView (uk.ac.ebi.spot.goci.curation.model.AssociationValidationView)1 DepositionSubmission (uk.ac.ebi.spot.goci.model.deposition.DepositionSubmission)1 Submission (uk.ac.ebi.spot.goci.model.deposition.Submission)1