Search in sources :

Example 26 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationVariantComparatorTest method compareVariantsSamePositionDiffOriginal.

@Test
public void compareVariantsSamePositionDiffOriginal() throws Exception {
    ByAnnotationVariantComparator comparator = new ByAnnotationVariantComparator();
    Annotation variant1 = mockAnnotationVariant(AnnotationCategory.VARIANT, "A", "V", new ByIsoformPositionComparatorTest.TargetIsoform("NX_P51610-4", 12, 12));
    Annotation variant2 = mockAnnotationVariant(AnnotationCategory.VARIANT, "C", "V", new ByIsoformPositionComparatorTest.TargetIsoform("NX_P51610-4", 12, 12));
    int cmp = comparator.compare(variant1, variant2);
    Assert.assertTrue(cmp < 0);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 27 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationVariantComparatorTest method mockAnnotationVariant.

private static Annotation mockAnnotationVariant(AnnotationCategory category, String original, String variant, ByIsoformPositionComparatorTest.TargetIsoform... targets) {
    Annotation mock = Mockito.mock(Annotation.class);
    when(mock.getVariant()).thenReturn(new AnnotationVariant(original, variant, ""));
    when(mock.getAPICategory()).thenReturn(category);
    Map<String, AnnotationIsoformSpecificity> map = new HashMap<>();
    for (ByIsoformPositionComparatorTest.TargetIsoform target : targets) {
        AnnotationIsoformSpecificity specificity = Mockito.mock(AnnotationIsoformSpecificity.class);
        when(specificity.getFirstPosition()).thenReturn(target.getStart());
        when(specificity.getLastPosition()).thenReturn(target.getEnd());
        when(specificity.getIsoformAccession()).thenReturn(target.getIsoformAccession());
        when(mock.getStartPositionForIsoform(target.getIsoformAccession())).thenReturn(target.getStart());
        when(mock.getEndPositionForIsoform(target.getIsoformAccession())).thenReturn(target.getEnd());
        map.put(target.getIsoformAccession(), specificity);
    }
    when(mock.getTargetingIsoformsMap()).thenReturn(map);
    return mock;
}
Also used : AnnotationVariant(org.nextprot.api.core.domain.annotation.AnnotationVariant) HashMap(java.util.HashMap) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Example 28 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationVariantComparatorTest method comparingNonVariantsThrowNextprotException.

@Test(expected = NextProtException.class)
public void comparingNonVariantsThrowNextprotException() throws Exception {
    ByAnnotationVariantComparator comparator = new ByAnnotationVariantComparator();
    Annotation variant2 = mockAnnotationVariant(AnnotationCategory.MUTAGENESIS, "A", "V", new ByIsoformPositionComparatorTest.TargetIsoform("NX_P51610-1", 14, 14), new ByIsoformPositionComparatorTest.TargetIsoform("NX_P51610-4", 12, 12));
    comparator.compare(new Annotation(), variant2);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 29 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class AnnotationListMergerBaseTest method mockAnnotation.

private static Annotation mockAnnotation(AnnotationCategory cat, QualityQualifier qq, List<AnnotationEvidence> evidences, String cvCode) {
    Annotation annotation = new Annotation();
    annotation.setAnnotationCategory(cat);
    annotation.setQualityQualifier(qq.name());
    annotation.setEvidences(evidences);
    annotation.setCvTermAccessionCode(cvCode);
    return annotation;
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Example 30 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class AnnotationListMergerBaseTest method mockAnnotationWithHash.

private static Annotation mockAnnotationWithHash(AnnotationCategory cat, QualityQualifier qq, List<AnnotationEvidence> evidences, String cvCode, String hash) {
    Annotation annotation = mockAnnotation(cat, qq, evidences, cvCode);
    annotation.setAnnotationHash(hash);
    return annotation;
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Aggregations

Annotation (org.nextprot.api.core.domain.annotation.Annotation)120 Test (org.junit.Test)79 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)32 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)28 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)22 ArrayList (java.util.ArrayList)19 Isoform (org.nextprot.api.core.domain.Isoform)17 Entry (org.nextprot.api.core.domain.Entry)9 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)7 BioObject (org.nextprot.api.core.domain.BioObject)7 PepXIsoformMatch (org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch)7 AnnotationProperty (org.nextprot.api.core.domain.annotation.AnnotationProperty)6 AnnotationSimilarityPredicate (org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate)6 Collectors (java.util.stream.Collectors)5 NextProtException (org.nextprot.api.commons.exception.NextProtException)5 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)5 Assert (org.junit.Assert)4 CvTerm (org.nextprot.api.core.domain.CvTerm)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 java.util (java.util)3