private Collection<String> convertAnnotToString(Collection<Annotation> annot){ Collection<String> annotations = new ArrayList<String>(annot.size()); for (Annotation a : annot){ if (a.getCvTopic() == null){ annotations.add(a.getAnnotationText() != null ? a.getAnnotationText() : ""); } else { annotations.add(a.getCvTopic().getShortLabel() + (a.getAnnotationText() != null ? a.getAnnotationText() : "")); } } return annotations; }
protected Annotation cloneAnnotation(Annotation annotation) throws IntactClonerException { if (annotation == null) return null; Annotation clone = new Annotation(); clonerManager.addClone(annotation, clone); clone.setCvTopic(clone(annotation.getCvTopic())); clone.setAnnotationText(annotation.getAnnotationText()); return clone; }
@Deprecated public Annotation( Institution owner, CvTopic topic ) { //super call sets creation time data super( ); setCvTopic( topic ); setOwner(owner); }
public Annotation createAnnotation(String annotationText, CvTopic cvTopic) { Annotation annotation = new Annotation(institution, cvTopic); annotation.setAnnotationText(annotationText); return annotation; }
public static boolean sameAnnotation( Annotation a1, Annotation a2 ) { if (a1.getAc() != null && a2.getAc() != null) { return a1.getAc().equals(a2.getAc()); } if ( !same( a1.getAnnotationText(), a2.getAnnotationText() ) ) { return false; } if ( !CvObjectUtils.areEqual( a1.getCvTopic(), a2.getCvTopic() ) ) { return false; } return true; }
if (this.areEqual(annot.getCvTopic(),annotation.getCvTopic())) { if ( annot.getAnnotationText() != null && annot.getAnnotationText().equals( annotation.getAnnotationText() ) ) { containsAnnotation = true; break; } else{ annot.setAnnotationText( annotation.getAnnotationText() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().update( annot ); containsAnnotation = true; final CvTopic topic = annotation.getCvTopic(); log.debug( "Added Annotation(" + topic.getShortLabel() + ", '" + annotation.getAnnotationText() + "') onto " + cvObject.getClass().getSimpleName() + "(" + cvObject.getShortLabel() + ")" );
public static boolean isNegative(Interaction interaction) { Collection<Annotation> annotations = fetchAnnotations(interaction); for (Annotation annotation : annotations) { if (annotation.getCvTopic() != null && annotation.getCvTopic().getShortLabel().equals(CvTopic.NEGATIVE)) { return true; } } return false; }
annotation = new Annotation( institution, cvTopic ); annotation.setAnnotationText( annotationTag.getText() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().persist( annotation ); for ( Iterator iterator3 = _annotations.iterator(); iterator3.hasNext() && annotation == null; ) { Annotation _annotation = (Annotation) iterator3.next(); if ( authorConfidence.equals( _annotation.getCvTopic() ) ) { annotation = _annotation; annotation = new Annotation( institution, authorConfidence ); annotation.setAnnotationText( confidence.getValue() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().persist( annotation );
if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { alreadyContainsObsolete = true; if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { annotatedText = annot.getAnnotationText(); final Annotation annotation = new Annotation( existingCv.getOwner(), obsoleteTopic, annotatedText ); existingCv.addAnnotation( annotation ); stats.addUpdatedCv( existingCv );
private void markAsHidden(CvObject cv, CvTopic hidden) { final Annotation hiddenAnnotation = new Annotation(hidden, null); cv.addAnnotation(hiddenAnnotation); corePersister.saveOrUpdate(cv); }
Annotation annotation = new Annotation( institution, topic ); annotation.setAnnotationText( text ); Annotation newAnnotation = new Annotation( institution, topic ); newAnnotation.setAnnotationText( text ); String oldText = annotation.getAnnotationText(); annotation.setAnnotationText( text ); String _text = annotation.getAnnotationText(); experiment.removeAnnotation( annotation );
@Transient @Deprecated /** * @deprecated now it is always stored as a simple annotation */ public String getPostalAddress() { Annotation annot = AnnotatedObjectUtils.findAnnotationByTopicMiOrLabel(this, "postaladdress"); return annot != null ? annot.getAnnotationText() : null; }
private Annotation synchronizeAnnotation( Annotation annotation, AnnotatedObject parent ) { if (annotation.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAnnotationDao().getByAc(annotation.getAc()); } else { } annotation.setCvTopic( synchronize( annotation.getCvTopic() ) ); if (annotation.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAnnotation(annotation, parent), annotation); } return annotation; }
@Override public void visitAnnotation( Annotation annotation ) { final CvTopic topic = annotation.getCvTopic(); final String mi = topic.getIdentifier(); if ( mi != null ) { final CvTopic oboTerm = ( CvTopic ) mi2cv.get( createCvKey( topic.getClass(), mi ) ); if ( oboTerm == null ) { log.warn( "Could not find topic " + topic.getClass().getSimpleName() + "( " + topic.getShortLabel() + " ) by MI: " + mi ); } else { annotation.setCvTopic( oboTerm ); } } } }
CvTopic cvTopic = annotation.getCvTopic(); cvTopic = (CvTopic) cvPersister.syncIfTransient(annotation.getCvTopic()); annotation.setCvTopic(cvTopic); annotation.setOwner(institutionPersister.syncIfTransient(annotation.getOwner()));
if (CvTopic.NON_UNIPROT.equalsIgnoreCase(a.getCvTopic().getShortLabel())){ hasNoUniprotUpdate = true; Annotation noUniprot = new Annotation(noUniprotUpdate); protein.addAnnotation(noUniprot);
protected void traverseAnnotation(Annotation annotation, IntactVisitor... visitors) { if (annotation == null) return; for (IntactVisitor visitor : visitors) { visitor.visitAnnotation(annotation); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(annotation)) { return; } traverse(annotation.getCvTopic(), visitors); traverse(annotation.getOwner(), visitors); }
public static void populateAnnotations(Collection<Attribute> attributesToConvert, Annotated annotated, Institution institution) { AnnotationConverter annotationConverter = new AnnotationConverter(institution); if (!attributesToConvert.isEmpty()) { for (Attribute attribute : attributesToConvert) { Annotation annotation = annotationConverter.psiToIntact(attribute); annotation.setOwner(institution); if (!annotated.getAnnotations().contains(annotation)) { annotated.getAnnotations().add(annotation); } } } }
/** * Creates a valid Annotation instance. A valid instance must have at least * a non-null Institution specified. A side-effect of this constructor is to * set the <code>created</code> and <code>updated</code> fields of the instance * to the current time. * * @param topic Refers to the controlled vocabulary topic this Annotation relates * to. This should be non-null. * * @throws NullPointerException thrown if no Institution specified. */ public Annotation( CvTopic topic ) { //super call sets creation time data super( ); setCvTopic( topic ); }
if (areSameCvObject(annot.getCvTopic(), clonedAnnotation.getCvTopic())) { annot.setAnnotationText(clonedAnnotation.getAnnotationText()); found = true;