Search in sources :

Example 1 with FeatureQuerySuccess

use of org.nextprot.api.isoform.mapper.domain.FeatureQuerySuccess in project nextprot-api by calipho-sib.

the class StatementTransformationUtil method getPropagatedStatementsForEntry.

static List<Statement> getPropagatedStatementsForEntry(IsoformMappingService isoformMappingService, Set<Statement> multipleSubjects, String nextprotAccession) {
    List<Statement> result = new ArrayList<>();
    for (Statement subject : multipleSubjects) {
        FeatureQueryResult featureQueryResult;
        featureQueryResult = isoformMappingService.propagateFeature(new SingleFeatureQuery(subject.getValue(StatementField.ANNOTATION_NAME), "variant", nextprotAccession));
        if (featureQueryResult.isSuccess()) {
            result.add(mapVariationStatementToEntry(subject, (FeatureQuerySuccess) featureQueryResult));
        } else {
            FeatureQueryFailure failure = (FeatureQueryFailure) featureQueryResult;
            String message = "Failure for " + subject.getStatementId() + " " + failure.getError().getMessage();
            LOGGER.error(message);
        }
    }
    if (result.size() == multipleSubjects.size()) {
        return result;
    } else {
        // return an empty list
        return new ArrayList<>();
    }
}
Also used : FeatureQuerySuccess(org.nextprot.api.isoform.mapper.domain.FeatureQuerySuccess) FeatureQueryFailure(org.nextprot.api.isoform.mapper.domain.FeatureQueryFailure) FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)

Aggregations

FeatureQueryFailure (org.nextprot.api.isoform.mapper.domain.FeatureQueryFailure)1 FeatureQueryResult (org.nextprot.api.isoform.mapper.domain.FeatureQueryResult)1 FeatureQuerySuccess (org.nextprot.api.isoform.mapper.domain.FeatureQuerySuccess)1 SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)1