Search in sources :

Example 1 with InvalidFeatureQueryFormatException

use of org.nextprot.api.isoform.mapper.domain.impl.exception.InvalidFeatureQueryFormatException in project nextprot-api by calipho-sib.

the class SequenceFeatureBase method newFeature.

public static SequenceFeature newFeature(SingleFeatureQuery query) throws FeatureQueryException {
    // throw exception if invalid query
    query.checkFeatureQuery();
    AnnotationCategory annotationCategory = AnnotationCategory.getDecamelizedAnnotationTypeName(query.getFeatureType());
    try {
        switch(annotationCategory) {
            case MUTAGENESIS:
            case VARIANT:
                return new SequenceVariant(query.getFeature());
            case GENERIC_PTM:
                return new SequenceModification(query.getFeature());
            default:
                throw new InvalidFeatureQueryTypeException(query);
        }
    } catch (ParseException e) {
        throw new InvalidFeatureQueryFormatException(query, e);
    }
}
Also used : AnnotationCategory(org.nextprot.api.commons.constants.AnnotationCategory) ParseException(java.text.ParseException) InvalidFeatureQueryTypeException(org.nextprot.api.isoform.mapper.domain.impl.exception.InvalidFeatureQueryTypeException) InvalidFeatureQueryFormatException(org.nextprot.api.isoform.mapper.domain.impl.exception.InvalidFeatureQueryFormatException)

Aggregations

ParseException (java.text.ParseException)1 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)1 InvalidFeatureQueryFormatException (org.nextprot.api.isoform.mapper.domain.impl.exception.InvalidFeatureQueryFormatException)1 InvalidFeatureQueryTypeException (org.nextprot.api.isoform.mapper.domain.impl.exception.InvalidFeatureQueryTypeException)1