use of org.nextprot.api.core.domain.annotation.AnnotationEvidence in project nextprot-api by calipho-sib.
the class AnnotationUtils method toString.
public static String toString(Annotation a) {
StringBuilder sb = new StringBuilder();
String sep = "\n";
sb.append("isProteoformAnnotation :").append(a.isProteoformAnnotation()).append(sep);
sb.append("getAnnotationHash :").append(a.getAnnotationHash()).append(sep);
sb.append("getAnnotationId :").append(a.getAnnotationId()).append(sep);
// sb.append("getAnnotationName :").append(a.getAnnotationName()).append(sep);
sb.append("getUniqueName :").append(a.getUniqueName()).append(sep);
// sb.append("getSubjectName :").append(a.getSubjectName()).append(sep);
sb.append("getDescription :").append(a.getDescription()).append(sep);
sb.append("getBioObject :").append(a.getBioObject() == null ? "null" : a.getBioObject()).append(sep);
sb.append("getSubjectComponents size :").append(a.getSubjectComponents() == null ? 0 : a.getSubjectComponents().size()).append(sep);
if (a.getSubjectComponents() != null) {
for (String c : a.getSubjectComponents()) sb.append("- component :").append(c).append(sep);
}
sb.append("getApiTypeName :").append(a.getApiTypeName()).append(sep);
sb.append("getCategory :").append(a.getCategory()).append(sep);
sb.append("getCategoryName :").append(a.getCategoryName()).append(sep);
sb.append("getCvTermAccessionCode :").append(a.getCvTermAccessionCode()).append(sep);
sb.append("getCvTermName :").append(a.getCvTermName()).append(sep);
sb.append("getEvidences.size :").append(a.getEvidences() == null ? 0 : a.getEvidences().size()).append(sep);
if (a.getEvidences() != null) {
for (AnnotationEvidence ae : a.getEvidences()) sb.append("- evidence :").append(ae.getEvidenceId()).append(sep);
}
sb.append("getTargetingIsoformsMap size:").append(a.getTargetingIsoformsMap() == null ? 0 : a.getTargetingIsoformsMap().size()).append(sep);
// sb.append("").append(a.).append(sep);
return sb.toString();
}
use of org.nextprot.api.core.domain.annotation.AnnotationEvidence in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldTurnSequenceCautionRelativeEvidenceIntoDifferingSequenceProperty.
@Test
public void shouldTurnSequenceCautionRelativeEvidenceIntoDifferingSequenceProperty() {
long annotId = 1234;
// create evidence (type=3)
AnnotationEvidence ev3 = new AnnotationEvidence();
ev3.setAnnotationId(annotId);
ev3.setAssignedBy(null);
ev3.setAssignmentMethod(null);
ev3.setEvidenceCodeAC("ECO-000003");
ev3.setEvidenceId(3000);
ev3.setNegativeEvidence(false);
ev3.setQualityQualifier("GOLD");
ev3.setResourceAccession("AC-0003");
ev3.setResourceAssociationType("evidence");
ev3.setResourceDb("DB-0003");
ev3.setResourceDescription("Resource descr 3");
ev3.setResourceId(3333);
ev3.setResourceType("database");
// create relative info (type=2)
AnnotationEvidence ev2 = new AnnotationEvidence();
ev2.setAnnotationId(annotId);
ev2.setAssignedBy(null);
ev2.setAssignmentMethod(null);
ev2.setEvidenceCodeAC(null);
ev2.setEvidenceId(2000);
ev2.setNegativeEvidence(false);
ev2.setQualityQualifier("SILVER");
ev2.setResourceAccession("AC-0002");
ev2.setResourceAssociationType("relative");
ev2.setResourceDb("DB-0002");
ev2.setResourceDescription("Resource descr 2");
ev2.setResourceId(2222);
ev2.setResourceType("database");
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(ev2);
evidences.add(ev3);
// create an annotation
Annotation annot = new Annotation();
annot.setAnnotationId(annotId);
annot.setUniqueName("some_sequence_caution_annotation");
annot.setCategory(AnnotationCategory.SEQUENCE_CAUTION.getDbAnnotationTypeName());
annot.setQualityQualifier("GOLD");
annot.setEvidences(evidences);
// will be modified by convertType2EvidencesToProperties()
annot.setDescription("");
List<Annotation> annotations = new ArrayList<>();
annotations.add(annot);
AnnotationUtils.convertRelativeEvidencesToProperties(annotations);
// evidence type 2 should removed
Assert.assertEquals(1, annotations.get(0).getEvidences().size());
// property should be created (replaces evidence removed)
Assert.assertEquals(1, annotations.get(0).getProperties().size());
assertContainsExpectedProperties(annotations.get(0).getProperties(), newAnnotationProperty(1234, "AC-0002", PropertyApiModel.NAME_DIFFERING_SEQUENCE, String.valueOf(ev2.getResourceId()), PropertyApiModel.VALUE_TYPE_RIF));
}
use of org.nextprot.api.core.domain.annotation.AnnotationEvidence in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method testConvertEvidenceToExternalBioObject.
// ----------------------------------
@Test
public void testConvertEvidenceToExternalBioObject() {
AnnotationEvidence ev = new AnnotationEvidence();
ev.setResourceAccession("CHEBI:38290");
ev.setResourceAssociationType("relative");
ev.setResourceDb("ChEBI");
ev.setResourceId(39334228);
BioObject bo = AnnotationUtils.newExternalChemicalBioObject(ev);
Assert.assertEquals("CHEBI:38290", bo.getAccession());
Assert.assertEquals("ChEBI", bo.getDatabase());
Assert.assertEquals(39334228, bo.getId());
Assert.assertEquals(BioObject.BioType.CHEMICAL, bo.getBioType());
}
use of org.nextprot.api.core.domain.annotation.AnnotationEvidence in project nextprot-api by calipho-sib.
the class AnnotationServiceTest method shouldGetAnOrphanetAnnotationFromService.
@Test
public void shouldGetAnOrphanetAnnotationFromService() {
List<Annotation> annotations = annotationService.findAnnotationsExcludingBed("NX_P10000");
assertEquals(1, annotations.size());
Annotation a = annotations.get(0);
assertEquals("disease", a.getCategory());
assertEquals("Some XR_ORPHA_100021 xref disease property value", a.getDescription());
assertEquals("GOLD", a.getQualityQualifier());
assertEquals(1, a.getEvidences().size());
AnnotationEvidence evi = a.getEvidences().get(0);
assertEquals("Orphanet", evi.getAssignedBy());
assertEquals("curated", evi.getAssignmentMethod());
assertEquals("IC", evi.getQualifierType());
assertEquals(false, evi.isNegativeEvidence());
assertEquals(true, evi.isValid());
assertEquals("XR_ORPHA_100021", evi.getResourceAccession());
assertEquals("Orphanet", evi.getResourceDb());
}
use of org.nextprot.api.core.domain.annotation.AnnotationEvidence in project nextprot-api by calipho-sib.
the class DbXrefServiceIntegrationTest method shouldReturn_1_OrphanetXrefAsAnnotation.
@Test
public void shouldReturn_1_OrphanetXrefAsAnnotation() {
List<Annotation> annotations = this.xrefService.findDbXrefsAsAnnotationsByEntry("NX_A0PJY2");
assertTrue(annotations.size() == 1);
Annotation annot = annotations.get(0);
assertTrue(annot.getCategory().equals(AnnotationCategory.DISEASE.getDbAnnotationTypeName()));
assertTrue(annot.getAPICategory() == AnnotationCategory.DISEASE);
assertTrue(annot.getQualityQualifier().equals("GOLD"));
Assert.assertEquals("Kallmann syndrome", 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("Orphanet"));
assertTrue(evi.getEvidenceCodeAC().equals("ECO:0000305"));
assertTrue(evi.getResourceAccession().equals("478"));
assertTrue(evi.getResourceDb().equals("Orphanet"));
Assert.assertTrue(annotations.get(0).getProperties().isEmpty());
}
Aggregations