use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class IsoformPEFFHeaderBuilderTest method newIsoformPEFFHeaderBuilder.
private IsoformPEFFHeaderBuilder newIsoformPEFFHeaderBuilder(String isoName) {
String entryAccession = isoformService.findEntryAccessionFromIsoformAccession(isoName);
Isoform isoform = isoformService.findIsoform(isoName);
List<Annotation> isoformAnnotations = annotationService.findAnnotations(entryAccession).stream().filter(annotation -> annotation.isSpecificForIsoform(isoName)).collect(Collectors.toList());
Overview overview = overviewService.findOverviewByEntry(entryAccession);
return new IsoformPEFFHeaderBuilder(isoform, isoformAnnotations, overview, terminologyService::findPsiModAccession, terminologyService::findPsiModName);
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase2.
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase2() {
// BinaryInteraction with 2 isoforms, 2 specific flag => should return 0 isoformDiplayed as specific
int isoCount = 2;
Map<String, AnnotationIsoformSpecificity> targetIsoformMap = new HashMap<>();
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("iso1");
spec1.setSpecificity("SPECIFIC");
targetIsoformMap.put("iso1", spec1);
AnnotationIsoformSpecificity spec2 = new AnnotationIsoformSpecificity();
spec2.setIsoformAccession("iso2");
spec2.setSpecificity("SPECIFIC");
targetIsoformMap.put("iso2", spec2);
Annotation annot = mock(Annotation.class);
when(annot.getAPICategory()).thenReturn(AnnotationCategory.BINARY_INTERACTION);
when(annot.getTargetingIsoformsMap()).thenReturn(targetIsoformMap);
List<String> result = AnnotationUtils.computeIsoformsDisplayedAsSpecific(annot, isoCount);
assertEquals(0, result.size());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldNotReturnAnnotationIfOverlapsALittleBit.
@Test
public void shouldNotReturnAnnotationIfOverlapsALittleBit() {
// This is used on the pepX logic, if you want to change the logic be careful (add a flag or change the method name for example), but keep the same logic for pepX
String isoName = "iso-1";
Annotation a1 = mock(Annotation.class);
when(a1.isAnnotationPositionalForIsoform(isoName)).thenReturn(true);
when(a1.getStartPositionForIsoform(isoName)).thenReturn(5);
when(a1.getEndPositionForIsoform(isoName)).thenReturn(10);
assertTrue(AnnotationUtils.filterAnnotationsBetweenPositions(10, 20, Arrays.asList(a1), isoName).isEmpty());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase1.
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase1() {
// BinaryInteraction with 2 isoforms, 1 specific flag => should return 1 isoformDiplayed as specific
int isoCount = 2;
Map<String, AnnotationIsoformSpecificity> targetIsoformMap = new HashMap<>();
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("iso1");
spec1.setSpecificity("SPECIFIC");
targetIsoformMap.put("iso1", spec1);
AnnotationIsoformSpecificity spec2 = new AnnotationIsoformSpecificity();
spec2.setIsoformAccession("iso2");
spec2.setSpecificity("BY DEFAULT");
targetIsoformMap.put("iso2", spec2);
Annotation annot = mock(Annotation.class);
when(annot.getAPICategory()).thenReturn(AnnotationCategory.BINARY_INTERACTION);
when(annot.getTargetingIsoformsMap()).thenReturn(targetIsoformMap);
List<String> result = AnnotationUtils.computeIsoformsDisplayedAsSpecific(annot, isoCount);
assertEquals(1, result.size());
assertEquals("iso1", result.get(0));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase4.
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase4() {
// BinaryInteraction with 1 isoform, 0 specific flag => 0 isoformDiplayed as specific
int isoCount = 1;
Map<String, AnnotationIsoformSpecificity> targetIsoformMap = new HashMap<>();
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("iso1");
spec1.setSpecificity("BY DEFAULT");
targetIsoformMap.put("iso1", spec1);
Annotation annot = mock(Annotation.class);
when(annot.getAPICategory()).thenReturn(AnnotationCategory.BINARY_INTERACTION);
when(annot.getTargetingIsoformsMap()).thenReturn(targetIsoformMap);
List<String> result = AnnotationUtils.computeIsoformsDisplayedAsSpecific(annot, isoCount);
assertEquals(0, result.size());
}
Aggregations