Search in sources :

Example 16 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation 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)

Example 17 with Annotation

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

the class DbXrefServiceIntegrationTest method shouldReturn_1_DrugBankXrefAsAnnotation.

@Test
public void shouldReturn_1_DrugBankXrefAsAnnotation() {
    List<Annotation> annotations = this.xrefService.findDbXrefsAsAnnotationsByEntry("NX_Q9Y2D1");
    assertTrue(annotations.size() == 1);
    Annotation annot = annotations.get(0);
    assertTrue(annot.getCategory().equals(AnnotationCategory.SMALL_MOLECULE_INTERACTION.getDbAnnotationTypeName()));
    assertTrue(annot.getAPICategory() == AnnotationCategory.SMALL_MOLECULE_INTERACTION);
    assertTrue(annot.getQualityQualifier().equals("GOLD"));
    Assert.assertEquals("Pseudoephedrine", 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("DrugBank"));
    assertTrue(evi.getEvidenceCodeAC().equals("ECO:0000305"));
    assertTrue(evi.getResourceAccession().equals("DB00852"));
    assertTrue(evi.getResourceDb().equals("DrugBank"));
    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)

Example 18 with Annotation

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

the class EntryAnnotationBuilderTest method shouldReturnOneSingleAnnotationIfTheInfoIsTheSameAndItIsComingFromDifferentSources.

@Test
public void shouldReturnOneSingleAnnotationIfTheInfoIsTheSameAndItIsComingFromDifferentSources() {
    Statement sb1 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308", "go-cellular-component", QualityQualifier.GOLD).addCvTerm("go-xxx", "nucleus", "go-cellular-component-cv").addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).addField(StatementField.EVIDENCE_CODE, "ECO:00001").addField(StatementField.ASSIGNED_BY, "TUTU").addSourceInfo("CAVA-VP0920190912", "BioEditor").buildWithAnnotationHash(AnnotationType.ENTRY);
    Statement sb2 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308", "go-cellular-component", QualityQualifier.GOLD).addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).addCvTerm("go-xxx", "nucleus", "go-cellular-component-cv").addField(StatementField.EVIDENCE_CODE, "ECO:00001").addField(StatementField.ASSIGNED_BY, "TOTO").addSourceInfo("HPA2222", "HPA").buildWithAnnotationHash(AnnotationType.ENTRY);
    List<Statement> statements = Arrays.asList(sb1, sb2);
    Annotation annotation = newAnnotationBuilder().buildAnnotation("NX_P01308", statements);
    Assert.assertEquals(annotation.getAPICategory(), AnnotationCategory.GO_CELLULAR_COMPONENT);
    Assert.assertEquals(annotation.getEvidences().size(), 2);
    Assert.assertEquals(annotation.getEvidences().get(0).getEvidenceCodeName(), "eco-name-1");
}
Also used : Statement(org.nextprot.commons.statements.Statement) TargetIsoformSet(org.nextprot.commons.statements.TargetIsoformSet) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 19 with Annotation

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

the class InteractionServiceIntegrationTest method shouldWork.

@Ignore
@Test
public void shouldWork() {
    String entryName = "NX_P38398";
    List<Annotation> annots = new ArrayList<>();
    List<Isoform> isoforms = this.isoformService.findIsoformsByEntryName(entryName);
    List<Interaction> interactions = this.interactionService.findInteractionsByEntry(entryName);
    System.out.println("Interaction count:" + interactions.size());
    for (Interaction inter : interactions) {
        Annotation annot = BinaryInteraction2Annotation.transform(inter, entryName, isoforms, mainNamesService);
        annots.add(annot);
        BioObject bo = annot.getBioObject();
        if (bo != null && (bo.getAccession().equals("NX_Q92560") || bo.getAccession().equals("Q99PU7"))) {
            System.out.print(inter.getEvidenceXrefAC() + ": ");
            System.out.print(inter.getInteractants().get(0).getAccession());
            if (inter.getInteractants().size() == 2)
                System.out.print(" <==> " + inter.getInteractants().get(1));
            System.out.println("");
            System.out.println(bo);
        }
    }
    System.out.println("Annot count:" + annots.size());
}
Also used : Interaction(org.nextprot.api.core.domain.Interaction) ArrayList(java.util.ArrayList) Isoform(org.nextprot.api.core.domain.Isoform) BinaryInteraction2Annotation(org.nextprot.api.core.utils.BinaryInteraction2Annotation) Annotation(org.nextprot.api.core.domain.annotation.Annotation) BioObject(org.nextprot.api.core.domain.BioObject) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 20 with Annotation

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

the class ByAnnotationBioObjectComparatorTest method compareAnnotationsDiffCat.

@Test
public void compareAnnotationsDiffCat() throws Exception {
    Annotation refAnnot1 = new Annotation();
    refAnnot1.setAnnotationCategory(AnnotationCategory.GO_CELLULAR_COMPONENT);
    refAnnot1.setAnnotationHash("010a85141bf174a186aaf714676cb397");
    refAnnot1.setCvTermName("transmission of nerve impulse");
    Annotation refAnnot2 = new Annotation();
    refAnnot2.setAnnotationCategory(AnnotationCategory.GO_BIOLOGICAL_PROCESS);
    refAnnot2.setAnnotationHash("3bffa5c7f436f45d5c9a2aec4757a492");
    refAnnot2.setCvTermName("spike train");
    ByAnnotationBioObjectComparator comparator = new ByAnnotationBioObjectComparator(newHashMap(refAnnot1, refAnnot2));
    Annotation annotation1 = new Annotation();
    annotation1.setBioObject(mockBioObject(BioObject.BioType.ENTRY_ANNOTATION, BioObject.ResourceType.EXTERNAL, "010a85141bf174a186aaf714676cb397"));
    Annotation annotation2 = new Annotation();
    annotation2.setBioObject(mockBioObject(BioObject.BioType.ENTRY_ANNOTATION, BioObject.ResourceType.EXTERNAL, "3bffa5c7f436f45d5c9a2aec4757a492"));
    int cmp = comparator.compare(annotation1, annotation2);
    Assert.assertEquals(1, cmp);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

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