Search in sources :

Example 36 with SingleFeatureQuery

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

the class IsoformMappingServiceTest method shouldValidateExtensionVariantOnCanonicalIsoformBadPos.

@Test
public void shouldValidateExtensionVariantOnCanonicalIsoformBadPos() throws Exception {
    SingleFeatureQuery query = new SingleFeatureQuery("RAD50-p.Ter1314Tyrext*66", AnnotationCategory.VARIANT.getApiTypeName(), "");
    FeatureQueryResult result = service.validateFeature(query);
    assertIsoformFeatureNotValid((FeatureQueryFailureImpl) result, new OutOfBoundSequencePositionException(query, 1313));
}
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 37 with SingleFeatureQuery

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

the class FeatureQueryExceptionTest method testUnknownFeatureIsoformException.

@Test
public void testUnknownFeatureIsoformException() throws FeatureQueryException {
    SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33");
    UnknownFeatureIsoformException featureQueryException = new UnknownFeatureIsoformException(SequenceVariantTest.mockEntry("NX_Q9UI33", SequenceVariantTest.mockIsoform("NX_Q9UI33-1", "Iso 1", true), SequenceVariantTest.mockIsoform("NX_Q9UI33-1", "Iso 2", false), SequenceVariantTest.mockIsoform("NX_Q9UI33-1", "Iso 3", false)), query, "spongebob");
    Assert.assertEquals("unknown isoform: cannot find isoform spongebob in entry NX_Q9UI33 (existing isoforms: [Iso 1, Iso 2, Iso 3])", featureQueryException.getReason().getMessage());
}
Also used : SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) Test(org.junit.Test) SequenceVariantTest(org.nextprot.api.isoform.mapper.domain.impl.SequenceVariantTest)

Example 38 with SingleFeatureQuery

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

the class FeatureQueryExceptionTest method testUnknownFeatureQueryTypeException.

@Test
public void testUnknownFeatureQueryTypeException() throws FeatureQueryException {
    SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.CATALYTIC_ACTIVITY.getApiTypeName(), "NX_Q9UI33");
    UnknownFeatureQueryTypeException featureQueryException = new UnknownFeatureQueryTypeException(query);
    Assert.assertEquals("unknown feature type: cannot find feature type CatalyticActivity", featureQueryException.getReason().getMessage());
}
Also used : SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) Test(org.junit.Test) SequenceVariantTest(org.nextprot.api.isoform.mapper.domain.impl.SequenceVariantTest)

Example 39 with SingleFeatureQuery

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

the class FeatureQueryExceptionTest method testUnexpectedAminoAcidsError.

@Test
public void testUnexpectedAminoAcidsError() throws FeatureQueryException {
    SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33");
    UnexpectedFeatureQueryAminoAcidException featureQueryException = new UnexpectedFeatureQueryAminoAcidException(query, 1158, new AminoAcidCode[] { AminoAcidCode.ALANINE }, new AminoAcidCode[] { AminoAcidCode.LEUCINE });
    Assert.assertEquals("Ala", featureQueryException.getReason().getCause("expectedAminoAcids"));
    Assert.assertEquals("Leu", featureQueryException.getReason().getCause("featureAminoAcids"));
    Assert.assertEquals(1158, featureQueryException.getReason().getCause("sequencePosition"));
    Assert.assertEquals("unexpected amino-acid: found Leu at position 1158 of NX_Q9UI33 sequence instead of expected Ala", featureQueryException.getReason().getMessage());
}
Also used : SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) Test(org.junit.Test) SequenceVariantTest(org.nextprot.api.isoform.mapper.domain.impl.SequenceVariantTest)

Example 40 with SingleFeatureQuery

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

the class FeatureQueryExceptionTest method testIncompatibleGeneAndProteinNameException.

@Test
public void testIncompatibleGeneAndProteinNameException() throws FeatureQueryException {
    SingleFeatureQuery query = new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_P01308");
    IncompatibleGeneAndProteinNameException featureQueryException = new IncompatibleGeneAndProteinNameException(query, "SCN11A", Lists.newArrayList("INS"));
    Assert.assertEquals("gene->protein incompatibility: protein NX_P01308 is not compatible with gene SCN11A (expected genes: [INS])", featureQueryException.getReason().getMessage());
}
Also used : SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) Test(org.junit.Test) SequenceVariantTest(org.nextprot.api.isoform.mapper.domain.impl.SequenceVariantTest)

Aggregations

SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)41 Test (org.junit.Test)36 FeatureQueryResult (org.nextprot.api.isoform.mapper.domain.FeatureQueryResult)33 IsoformMappingBaseTest (org.nextprot.api.isoform.mapper.IsoformMappingBaseTest)29 SequenceVariantTest (org.nextprot.api.isoform.mapper.domain.impl.SequenceVariantTest)6 FeatureQueryFailureImpl (org.nextprot.api.isoform.mapper.domain.impl.FeatureQueryFailureImpl)3 Isoform (org.nextprot.api.core.domain.Isoform)2 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 ParseException (java.text.ParseException)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 SequenceVariation (org.nextprot.api.commons.bio.variation.prot.SequenceVariation)1 Entry (org.nextprot.api.core.domain.Entry)1 GeneMasterCodonPosition (org.nextprot.api.core.utils.seqmap.GeneMasterCodonPosition)1