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);
}
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;
}
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);
}
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;
}
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;
}
Aggregations