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