use of org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForNonBinaryInteractionCase3.
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForNonBinaryInteractionCase3() {
// BinaryInteraction with 1 isoform, 1 targetingIsoform record => should return 0 isoformDiplayed as specific
int isoCount = 1;
Map<String, AnnotationIsoformSpecificity> targetIsoformMap = new HashMap<>();
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("iso1");
spec1.setSpecificity("SPECIFIC");
targetIsoformMap.put("iso1", spec1);
Annotation annot = mock(Annotation.class);
when(annot.getAPICategory()).thenReturn(AnnotationCategory.GO_MOLECULAR_FUNCTION);
when(annot.getTargetingIsoformsMap()).thenReturn(targetIsoformMap);
List<String> result = AnnotationUtils.computeIsoformsDisplayedAsSpecific(annot, isoCount);
assertEquals(0, result.size());
}
use of org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForNonBinaryInteractionCase1.
// --------------------------------
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForNonBinaryInteractionCase1() {
// Non BinaryInteraction with 2 isoforms, 2 targetingIsoform records => 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("BY DEFAULT");
targetIsoformMap.put("iso2", spec2);
Annotation annot = mock(Annotation.class);
when(annot.getAPICategory()).thenReturn(AnnotationCategory.GO_MOLECULAR_FUNCTION);
when(annot.getTargetingIsoformsMap()).thenReturn(targetIsoformMap);
List<String> result = AnnotationUtils.computeIsoformsDisplayedAsSpecific(annot, isoCount);
assertEquals(0, result.size());
}
use of org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase3.
@Test
public void shouldcomputeIsoformsDisplayedAsSpecificForBinaryInteractionCase3() {
// BinaryInteraction with 1 isoform, 1 specific flag => 0 isoformDiplayed as specific
int isoCount = 1;
Map<String, AnnotationIsoformSpecificity> targetIsoformMap = new HashMap<>();
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("iso1");
spec1.setSpecificity("SPECIFIC");
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());
}
use of org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity in project nextprot-api by calipho-sib.
the class AnnotationUtilsUnconfirmedPE1Test method createPeptideMappingAnnot.
private Annotation createPeptideMappingAnnot(int id, String pepname, Integer p1, Integer p2, boolean proteotypic) {
Annotation a = new Annotation();
a.setAnnotationCategory(AnnotationCategory.PEPTIDE_MAPPING);
a.setAnnotationId(id);
AnnotationProperty p = new AnnotationProperty();
p.setName("is proteotypic");
p.setValue(proteotypic ? "Y" : "N");
a.addProperty(p);
if (pepname != null) {
p = new AnnotationProperty();
p.setName("peptide name");
p.setValue(pepname);
a.addProperty(p);
}
AnnotationIsoformSpecificity spec1 = new AnnotationIsoformSpecificity();
spec1.setIsoformAccession("NX_P10000-1");
spec1.setFirstPosition(p1);
spec1.setLastPosition(p2);
AnnotationIsoformSpecificity spec2 = new AnnotationIsoformSpecificity();
spec2.setIsoformAccession("NX_P10000-2");
spec2.setFirstPosition(p1 == null ? null : p1 + 10);
spec2.setLastPosition(p2 == null ? null : p2 + 10);
List<AnnotationIsoformSpecificity> specs = new ArrayList<>();
specs.add(spec1);
specs.add(spec2);
a.addTargetingIsoforms(specs);
return a;
}
use of org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity in project nextprot-api by calipho-sib.
the class DbXrefServiceIntegrationTest method shouldReturn_1_KEGGPathwayXrefAsAnnotation.
@Test
public void shouldReturn_1_KEGGPathwayXrefAsAnnotation() {
List<Annotation> annotations = this.xrefService.findDbXrefsAsAnnotationsByEntry("NX_A1L167");
assertTrue(annotations.size() == 1);
Annotation annot = annotations.get(0);
assertTrue(annot.getCategory().equals(AnnotationCategory.PATHWAY.getDbAnnotationTypeName()));
assertTrue(annot.getAPICategory() == AnnotationCategory.PATHWAY);
assertTrue(annot.getQualityQualifier().equals("GOLD"));
Assert.assertEquals("Ubiquitin mediated proteolysis", annot.getDescription());
for (AnnotationIsoformSpecificity spec : annot.getTargetingIsoformsMap().values()) {
assertTrue(spec.getSpecificity().equals("UNKNOWN"));
}
assertTrue(annot.getEvidences().size() == 1);
AnnotationEvidence evi = annot.getEvidences().get(0);
assertTrue(evi.getAssignedBy().equals("KEGG_PTW"));
assertTrue(evi.getEvidenceCodeAC().equals("ECO:0000305"));
assertTrue(evi.getResourceAccession().equals("hsa04120+134111"));
assertTrue(evi.getResourceDb().equals("KEGGPathway"));
Assert.assertTrue(annotations.get(0).getProperties().isEmpty());
}
Aggregations