use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ByAnnotationSubjectComparatorTest method compareAnnotationsFirstDefinedSubjectComponent.
@Test
public void compareAnnotationsFirstDefinedSubjectComponent() throws Exception {
ByAnnotationSubjectComparator comparator = new ByAnnotationSubjectComparator(new HashMap<>());
Annotation a1 = new Annotation();
a1.setSubjectComponents(Collections.emptyList());
int cmp = comparator.compare(a1, new Annotation());
Assert.assertEquals(-1, cmp);
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ByAnnotationSubjectComparatorTest method compareAnnotationsCannotFindOneSubjectAnnot.
@Test(expected = NextProtException.class)
public void compareAnnotationsCannotFindOneSubjectAnnot() throws Exception {
ByAnnotationSubjectComparator comparator = new ByAnnotationSubjectComparator(newHashMap(mockAnnotation(AnnotationCategory.VARIANT, "hash1")));
Annotation a1 = new Annotation();
a1.setSubjectComponents(Collections.singletonList("hash1"));
Annotation a2 = new Annotation();
a2.setSubjectComponents(Collections.singletonList("hash2"));
int cmp = comparator.compare(a1, a2);
Assert.assertEquals(0, cmp);
}
use of org.nextprot.api.core.domain.annotation.Annotation 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;
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class InteractionServiceImpl method findInteractionsAsAnnotationsByEntry.
@Override
@Cacheable("interactions-as-annot")
public List<Annotation> findInteractionsAsAnnotationsByEntry(String entryName) {
List<Annotation> annots = new ArrayList<>();
List<Isoform> isoforms = this.isoService.findIsoformsByEntryName(entryName);
List<Interaction> interactions = this.interactionDAO.findInteractionsByEntry(entryName);
for (Interaction inter : interactions) {
Annotation annot = BinaryInteraction2Annotation.transform(inter, entryName, isoforms, mainNamesService);
annots.add(annot);
}
// returns a immutable list when the result is cacheable (this prevents modifying the cache, since the cache returns a reference) copy on read and copy on write is too much time consuming
return new ImmutableList.Builder<Annotation>().addAll(annots).build();
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationBaseMerger method merge.
@Override
public Annotation merge(Annotation annotation1, Annotation annotation2) {
Annotation dest = getDestAnnotation(annotation1, annotation2);
Annotation source = getSourceAnnotation(annotation1, annotation2);
updateDestEvidences(dest, source);
updateDestAnnotationHash(dest, source);
updateDestIsoformSpecificityName(dest, source);
updateDestQualityQualifier(dest, source);
updateDestBioObject(dest, source);
return dest;
}
Aggregations