Search in sources :

Example 1 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult 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)

Example 2 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldReturnError.

@Test
public void shouldReturnError() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p-iso4.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33"));
    Assert.assertTrue(!result.isSuccess());
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 3 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldValidateExtensionVariantOnCanonicalIsoformBadPos1.

@Test
public void shouldValidateExtensionVariantOnCanonicalIsoformBadPos1() throws Exception {
    SingleFeatureQuery query = new SingleFeatureQuery("BCL2-p.Met1ext-5", AnnotationCategory.VARIANT.getApiTypeName(), "");
    FeatureQueryResult result = service.validateFeature(query);
    assertIsoformFeatureValid(result, "NX_P10415-1", 1, 1, true);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 4 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldValidateMutagenesisOnCanonicalIsoform.

@Test
public void shouldValidateMutagenesisOnCanonicalIsoform() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("ACVR1-p.Gln207Asp", AnnotationCategory.MUTAGENESIS.getApiTypeName(), ""));
    assertIsoformFeatureValid(result, "NX_Q04771-1", 207, 207, true);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 5 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldNotValidateWithGeneNoAccession.

@Test
public void shouldNotValidateWithGeneNoAccession() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN14A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), ""));
    SingleFeatureQuery query = Mockito.mock(SingleFeatureQuery.class);
    when(query.getAccession()).thenReturn("");
    assertIsoformFeatureNotValid((FeatureQueryFailureImpl) result, new EntryAccessionNotFoundForGeneException(query, "SCN14A"));
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Aggregations

FeatureQueryResult (org.nextprot.api.isoform.mapper.domain.FeatureQueryResult)33 SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)33 Test (org.junit.Test)29 IsoformMappingBaseTest (org.nextprot.api.isoform.mapper.IsoformMappingBaseTest)29 FeatureQueryFailureImpl (org.nextprot.api.isoform.mapper.domain.impl.FeatureQueryFailureImpl)3 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Function (java.util.function.Function)1 Ignore (org.junit.Ignore)1 AminoAcidCode (org.nextprot.api.commons.bio.AminoAcidCode)1 FeatureQueryFailure (org.nextprot.api.isoform.mapper.domain.FeatureQueryFailure)1 FeatureQuerySuccess (org.nextprot.api.isoform.mapper.domain.FeatureQuerySuccess)1 MultipleFeatureQuery (org.nextprot.api.isoform.mapper.domain.MultipleFeatureQuery)1