use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery 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);
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery 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));
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery 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;
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class FeatureQueryExceptionTest method testInvalidFeatureQueryFormatException.
@Test
public void testInvalidFeatureQueryFormatException() throws FeatureQueryException {
SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_P01308");
InvalidFeatureQueryFormatException featureQueryException = new InvalidFeatureQueryFormatException(query, Mockito.mock(ParseException.class));
Assert.assertEquals("invalid feature format: SCN11A-p.Leu1158Pro", featureQueryException.getReason().getMessage());
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class FeatureQueryExceptionTest method testOutOfBoundSequencePositionException.
@Test
public void testOutOfBoundSequencePositionException() throws FeatureQueryException {
SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33");
OutOfBoundSequencePositionException featureQueryException = new OutOfBoundSequencePositionException(query, 23);
Assert.assertEquals("out of bound sequence position: position 23 of NX_Q9UI33 sequence", featureQueryException.getReason().getMessage());
}
Aggregations