Search in sources :

Example 21 with ValidationError

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

the class ValidationChecksBuilder method runAuthorLevelNoEffectChecks.

/**
     * Run no effect checks on a row
     *
     * @param association row to be checked
     */
public Collection<ValidationError> runAuthorLevelNoEffectChecks(Association association) {
    Collection<ValidationError> validationErrors = new ArrayList<>();
    ValidationError orFound = errorCreationService.checkOrEmpty(association.getOrPerCopyNum());
    validationErrors.add(orFound);
    ValidationError betaFound = errorCreationService.checkBetaValuesIsEmpty(association.getBetaNum());
    validationErrors.add(betaFound);
    ValidationError betaUnitFound = errorCreationService.checkBetaUnitIsEmpty(association.getBetaUnit());
    validationErrors.add(betaUnitFound);
    ValidationError betaDirectionFound = errorCreationService.checkBetaDirectionIsEmpty(association.getBetaDirection());
    validationErrors.add(betaDirectionFound);
    ValidationError rangeFound = errorCreationService.checkRangeIsEmpty(association.getRange());
    validationErrors.add(rangeFound);
    return ErrorProcessingService.checkForValidErrors(validationErrors);
}
Also used : ArrayList(java.util.ArrayList) ValidationError(uk.ac.ebi.spot.goci.model.ValidationError)

Example 22 with ValidationError

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

the class ValidationChecksBuilder method runAuthorLevelOrChecks.

/**
     * Run OR checks on a row
     *
     * @param association association to be checked
     */
public Collection<ValidationError> runAuthorLevelOrChecks(Association association) {
    Collection<ValidationError> validationErrors = new ArrayList<>();
    ValidationError betaFoundForOr = errorCreationService.checkBetaValuesIsEmpty(association.getBetaNum());
    validationErrors.add(betaFoundForOr);
    ValidationError betaUnitFoundForOr = errorCreationService.checkBetaUnitIsEmpty(association.getBetaUnit());
    validationErrors.add(betaUnitFoundForOr);
    ValidationError betaDirectionFoundForOr = errorCreationService.checkBetaDirectionIsEmpty(association.getBetaDirection());
    validationErrors.add(betaDirectionFoundForOr);
    ValidationError rangeNotFound = errorCreationService.checkRangeIsPresent(association.getRange());
    validationErrors.add(rangeNotFound);
    return ErrorProcessingService.checkForValidErrors(validationErrors);
}
Also used : ArrayList(java.util.ArrayList) ValidationError(uk.ac.ebi.spot.goci.model.ValidationError)

Example 23 with ValidationError

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

the class ValidationChecksBuilder method runRiskFrequencyChecks.

/**
     * Run risk frequency checks on association and the risk alleles linked to a locus
     *
     * @param association row to be checked
     */
public Collection<ValidationError> runRiskFrequencyChecks(Association association) {
    Collection<ValidationError> validationErrors = new ArrayList<>();
    // Check the association risk frequency
    validationErrors.add(errorCreationService.checkAssociationRiskFrequency(association.getRiskFrequency()));
    // Check risk frequency on alleles if its a SNP interaction association
    if (association.getSnpInteraction()) {
        for (Locus locus : association.getLoci()) {
            locus.getStrongestRiskAlleles().forEach(riskAllele -> {
                validationErrors.add(errorCreationService.checkAlleleRiskFrequency(riskAllele.getRiskFrequency()));
            });
        }
    }
    return ErrorProcessingService.checkForValidErrors(validationErrors);
}
Also used : ArrayList(java.util.ArrayList) ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Locus(uk.ac.ebi.spot.goci.model.Locus)

Example 24 with ValidationError

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

the class ValidationChecksBuilder method runBetaChecks.

/**
     * Run Beta checks on a row
     *
     * @param association row to be checked
     */
public Collection<ValidationError> runBetaChecks(Association association) {
    Collection<ValidationError> validationErrors = new ArrayList<>();
    ValidationError betaIsPresent = errorCreationService.checkBetaIsPresentAndIsNotNegative(association.getBetaNum());
    validationErrors.add(betaIsPresent);
    ValidationError betaUnitNotFound = errorCreationService.checkBetaUnitIsPresent(association.getBetaUnit());
    validationErrors.add(betaUnitNotFound);
    ValidationError betaDirectionNotFound = errorCreationService.checkBetaDirectionIsPresent(association.getBetaDirection());
    validationErrors.add(betaDirectionNotFound);
    ValidationError orFound = errorCreationService.checkOrEmpty(association.getOrPerCopyNum());
    validationErrors.add(orFound);
    ValidationError orRecipFound = errorCreationService.checkOrRecipEmpty(association.getOrPerCopyRecip());
    validationErrors.add(orRecipFound);
    ValidationError orRecipRangeFound = errorCreationService.checkOrPerCopyRecipRangeIsEmpty(association.getOrPerCopyRecipRange());
    validationErrors.add(orRecipRangeFound);
    ValidationError rangeNotFound = errorCreationService.checkRangeIsPresent(association.getRange());
    validationErrors.add(rangeNotFound);
    return ErrorProcessingService.checkForValidErrors(validationErrors);
}
Also used : ArrayList(java.util.ArrayList) ValidationError(uk.ac.ebi.spot.goci.model.ValidationError)

Example 25 with ValidationError

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

the class ValidationChecksBuilder method runAnnotationChecks.

/**
     * Run general checks on a row annotation
     *
     * @param association association to be checked
     */
public Collection<ValidationError> runAnnotationChecks(Association association) {
    Collection<ValidationError> validationErrors = new ArrayList<>();
    validationErrors.add(errorCreationService.checkSnpType(association.getSnpType()));
    if (association.getSnpInteraction()) {
        for (Locus locus : association.getLoci()) {
            locus.getStrongestRiskAlleles().forEach(riskAllele -> {
                Boolean genomeWide = riskAllele.getGenomeWide();
                Boolean limitedList = riskAllele.getLimitedList();
                validationErrors.add(errorCreationService.checkSnpStatusIsPresent(genomeWide, limitedList));
            });
        }
    }
    return ErrorProcessingService.checkForValidErrors(validationErrors);
}
Also used : ArrayList(java.util.ArrayList) ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Locus(uk.ac.ebi.spot.goci.model.Locus)

Aggregations

ValidationError (uk.ac.ebi.spot.goci.model.ValidationError)46 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)11 Locus (uk.ac.ebi.spot.goci.model.Locus)3 Association (uk.ac.ebi.spot.goci.model.Association)2 AssociationSummary (uk.ac.ebi.spot.goci.model.AssociationSummary)2 RowValidationSummary (uk.ac.ebi.spot.goci.model.RowValidationSummary)2 File (java.io.File)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 XSSFCell (org.apache.poi.xssf.usermodel.XSSFCell)1 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1