use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationClusterTest method addAnnotationFailedIfOfDifferentCategory.
@Test(expected = AnnotationCluster.InvalidAnnotationClusterCategoryException.class)
public void addAnnotationFailedIfOfDifferentCategory() throws Exception {
AnnotationCluster cluster = new AnnotationCluster(AnnotationCategory.VARIANT);
Annotation annotation = mockAnnotation(AnnotationCategory.MUTAGENESIS);
cluster.add(annotation);
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationClusterTest method testAddAnnotation.
@Test
public void testAddAnnotation() throws Exception {
AnnotationCluster cluster = new AnnotationCluster(AnnotationCategory.VARIANT);
Annotation annotation = mockAnnotation(AnnotationCategory.VARIANT);
cluster.add(annotation);
Assert.assertEquals(1, cluster.size());
Assert.assertEquals(AnnotationCategory.VARIANT, cluster.getCategory());
}
use of org.nextprot.api.core.domain.annotation.Annotation 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.Annotation 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());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class DbXrefServiceIntegrationTest method shouldReturn_1_ReactomeXrefAsAnnotation.
/*
* This query finds entries having a single xref among 'Orphanet', 'KEGGPathway' , 'Reactome' and 'DrugBank'
* It is convenient for tests: we know we get a single annotation from xrefs for a given entry
* Example:
* NX_A0AVF1 for Reactome
* NX_A1L167 for Kegg
* NX_A0PJY2 for Orphanet
* NX_Q9Y2D1 for DrugBank
select a.unique_name, string_agg(a.acs, ',') as acs, string_agg(a.cv_name, ',') as dbs, count(*) as dbcount, sum(a.cnt) as xrcount from (
select si.unique_name, db.cv_name, count(*) as cnt, string_agg(x.accession, ',') as acs
from sequence_identifiers si
inner join identifier_resource_assoc ira on (si.identifier_id=ira.identifier_id)
inner join db_xrefs x on (ira.resource_id=x.resource_id)
inner join cv_databases db on (x.cv_database_id=db.cv_id)
where si.cv_type_id=1 and si.cv_status_id=1
and db.cv_name in ('Orphanet', 'DrugBank','KEGGPathway','Reactome')
group by si.unique_name, db.cv_name
) a
group by a.unique_name
having sum(a.cnt)=1
;
*/
@Test
public void shouldReturn_1_ReactomeXrefAsAnnotation() {
List<Annotation> annotations = this.xrefService.findDbXrefsAsAnnotationsByEntry("NX_A0AVF1");
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("Intraflagellar transport", 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("Reactome"));
assertTrue(evi.getEvidenceCodeAC().equals("ECO:0000305"));
assertTrue(evi.getResourceAccession().equals("R-HSA-5620924"));
assertTrue(evi.getResourceDb().equals("Reactome"));
Assert.assertTrue(annotations.get(0).getProperties().isEmpty());
}
Aggregations