Search in sources :

Example 1 with AnnotationIsoformSpecificity

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());
}
Also used : AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 2 with AnnotationIsoformSpecificity

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());
}
Also used : AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 3 with AnnotationIsoformSpecificity

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());
}
Also used : AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 4 with AnnotationIsoformSpecificity

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;
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty) ArrayList(java.util.ArrayList) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Example 5 with AnnotationIsoformSpecificity

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());
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Aggregations

AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)24 Annotation (org.nextprot.api.core.domain.annotation.Annotation)19 Test (org.junit.Test)12 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)12 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)5 Isoform (org.nextprot.api.core.domain.Isoform)3 ArrayList (java.util.ArrayList)2 AnnotationProperty (org.nextprot.api.core.domain.annotation.AnnotationProperty)2 AnnotationVariant (org.nextprot.api.core.domain.annotation.AnnotationVariant)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)1 NextProtException (org.nextprot.api.commons.exception.NextProtException)1 Family (org.nextprot.api.core.domain.Family)1 PepXIsoformMatch (org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch)1 TargetIsoformStatementPosition (org.nextprot.commons.statements.TargetIsoformStatementPosition)1