Search in sources :

Example 11 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldNotMapMet1_Lys170Deletion.

@Test
public void shouldNotMapMet1_Lys170Deletion() throws Exception {
    SingleFeatureQuery query = new SingleFeatureQuery("BARD1-p.Met1_Lys170del", AnnotationCategory.VARIANT.getApiTypeName(), "");
    FeatureQueryResult result = service.propagateFeature(query);
    assertIsoformFeatureValid(result, "NX_Q99728-1", 1, 170, true);
    assertIsoformFeatureValid(result, "NX_Q99728-2", null, null, false);
    assertIsoformFeatureValid(result, "NX_Q99728-3", null, null, false);
    assertIsoformFeatureValid(result, "NX_Q99728-4", null, null, false);
}
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 12 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldNotValidateInvalidPositionVariantIsoform.

@Test
public void shouldNotValidateInvalidPositionVariantIsoform() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p.Leu1158999Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33"));
    SingleFeatureQuery query = Mockito.mock(SingleFeatureQuery.class);
    when(query.getAccession()).thenReturn("NX_Q9UI33");
    assertIsoformFeatureNotValid((FeatureQueryFailureImpl) result, new OutOfBoundSequencePositionException(query, 1158999));
}
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 13 with FeatureQueryResult

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

the class IsoformMappingService method handleMultipleQueries.

/**
 * Execute the given single feature query function to each feature query
 * @param multipleFeatureQuery multiple feature query
 * @param function the function that process a FeatureQuery and produces FeatureQueryResult
 * @return a map of results
 */
default Map<String, FeatureQueryResult> handleMultipleQueries(MultipleFeatureQuery multipleFeatureQuery, Function<SingleFeatureQuery, FeatureQueryResult> function) {
    Map<String, FeatureQueryResult> results = new HashMap<>(multipleFeatureQuery.getFeatureList().size() + multipleFeatureQuery.getFeatureMaps().size());
    multipleFeatureQuery.getFeatureList().stream().filter(feature -> !results.containsKey(feature)).forEach(feature -> results.put(feature, function.apply(new SingleFeatureQuery(feature, multipleFeatureQuery.getFeatureType(), multipleFeatureQuery.getAccession()))));
    multipleFeatureQuery.getFeatureMaps().stream().filter(featureQuery -> !results.containsKey(featureQuery.get("feature"))).forEach(featureQuery -> results.put(featureQuery.get("feature"), function.apply(new SingleFeatureQuery(featureQuery.get("feature"), multipleFeatureQuery.getFeatureType(), featureQuery.get("accession")))));
    return results;
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) Map(java.util.Map) HashMap(java.util.HashMap) Function(java.util.function.Function) MultipleFeatureQuery(org.nextprot.api.isoform.mapper.domain.MultipleFeatureQuery) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) HashMap(java.util.HashMap)

Example 14 with FeatureQueryResult

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

the class IsoformMappingLocalMockImpl method main.

public static void main(String[] args) {
    IsoformMappingLocalMockImpl mi = new IsoformMappingLocalMockImpl();
    FeatureQueryResult fq = mi.propagateFeature(new SingleFeatureQuery("SCN9A-iso3-p.Met932Leu", "variant", null));
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)

Example 15 with FeatureQueryResult

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

the class IsoformMappingServiceTest method shouldValidateWithNullAccession.

@Test
public void shouldValidateWithNullAccession() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), null));
    assertIsoformFeatureValid(result, "NX_Q9UI33-1", 1158, 1158, true);
    Assert.assertEquals("NX_Q9UI33", result.getQuery().getAccession());
}
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