if ( !cvTopic.equals( annotation.cvTopic ) ) { return false;
/** * Selects from the given Annotation collection all items having the given CvTopic. * * @param annotations a collection we have to filter * @param topic the filter * * @return a new collection containing all matching annotations */ private static Collection<Annotation> select( Collection<Annotation> annotations, CvTopic topic ) { if ( annotations == null || annotations.isEmpty() ) { return Collections.EMPTY_LIST; } ArrayList list = new ArrayList( 2 ); for ( Iterator<Annotation> iterator = annotations.iterator(); iterator.hasNext(); ) { Annotation annotation = iterator.next(); if ( annotation.getCvTopic().equals( topic ) ) { list.add( annotation ); } } return list; }
/** * Answers the question: is that AnnotatedObject (Interaction, Experiment) annotated as negative ? * * @param annotatedObject the object we want to introspect * * @return true if the object is annotated with the 'negative' CvTopic, otherwise false. */ public boolean isNegative(AnnotatedObject annotatedObject) { boolean isNegative = false; Collection<Annotation> annotations = annotatedObject.getAnnotations(); for (Iterator<Annotation> iterator = annotations.iterator(); iterator.hasNext() && false == isNegative;) { Annotation annotation = iterator.next(); if (getNegative().equals(annotation.getCvTopic())) { isNegative = true; } } return isNegative; }
return false; if ( detectionMethod != null ? !detectionMethod.equals( that.detectionMethod ) : that.detectionMethod != null ) { return false;
/** * Checks if the protein has been annotated with the no-uniprot-update CvTopic, if so, return false, otherwise true. * That flag is added to a protein when created via the editor. As some protein may have a UniProt ID as identity we * don't want those to be overwitten. * * @param protein the protein to check * * @return false if no Annotation having CvTopic( no-uniprot-update ), otherwise true. */ protected boolean needsUniprotUpdate(final Protein protein) { boolean needsUpdate = true; final CvTopic noUniprotUpdate = getNoUniprotUpdate(); if (null == noUniprotUpdate) { // in case the term hasn't been created, assume there are no proteins created via editor. return true; } for (Iterator<Annotation> iterator = protein.getAnnotations().iterator(); iterator.hasNext() && true == needsUpdate;) { Annotation annotation = iterator.next(); if (noUniprotUpdate.equals(annotation.getCvTopic())) { needsUpdate = false; } } return needsUpdate; }
/** * Answers the question: is that AnnotatedObject (Interaction, Experiment) annotated as negative ? * * @param annotatedObject the object we want to introspect * * @return true if the object is annotated with the 'negative' CvTopic, otherwise false. */ public boolean isNegative(AnnotatedObject annotatedObject) { boolean isNegative = false; Collection<Annotation> annotations = annotatedObject.getAnnotations(); for (Iterator<Annotation> iterator = annotations.iterator(); iterator.hasNext() && false == isNegative;) { Annotation annotation = iterator.next(); if (getCvContext().getByLabel(CvTopic.class, CvTopic.NEGATIVE).equals(annotation.getCvTopic())) { isNegative = true; } } return isNegative; }
private static String getAnnotationValue(Experiment experiment, CvTopic topic) { for (Annotation annotation : experiment.getAnnotations()) { if (topic.equals(annotation.getCvTopic())) { return annotation.getAnnotationText(); } } return null; }
/** * @param interaction * * @return */ protected Collection<String> getCCnote(Interaction interaction) { Collection<String> notes = null; final CvTopic ccNote = (CvTopic) getCvObject( CvTopic.class, null, CvTopic.CC_NOTE ); for (Annotation annotation : interaction.getAnnotations()) { if (ccNote.equals(annotation.getCvTopic())) { if (notes == null) { notes = new ArrayList<String>(2); // should rarely have more than 2 } notes.add(annotation.getAnnotationText()); } } return notes; }
if ( obsolete.equals( annotation.getCvTopic() ) ) {
/** * Checks if the protein has been annotated with the no-uniprot-update CvTopic, if so, return false, otherwise true. * That flag is added to a protein when created via the editor. As some protein may have a UniProt ID as identity we * don't want those to be overwitten. * * @param protein the protein to check * * @return false if no Annotation having CvTopic( no-uniprot-update ), otherwise true. */ protected boolean needsUniprotUpdate(final Protein protein) { boolean needsUpdate = true; CvTopic noUniprotUpdate = getCvContext().getByLabel(CvTopic.class, CvTopic.NON_UNIPROT); if (null == noUniprotUpdate) { // in case the term hasn't been created, assume there are no proteins created via editor. return true; } for (Iterator<Annotation> iterator = protein.getAnnotations().iterator(); iterator.hasNext() && true == needsUpdate;) { Annotation annotation = iterator.next(); if (noUniprotUpdate.equals(annotation.getCvTopic())) { needsUpdate = false; } } return needsUpdate; }
if ( obsolete.equals( annotation.getCvTopic() ) ) {
if ( obsolete.equals( annotation.getCvTopic() ) ) {
/** * @param interaction * * @return */ protected Collection<String> getCCnote(Interaction interaction) { Collection<String> notes = null; for (Annotation annotation : interaction.getAnnotations()) { if (getCvContext().getByLabel(CvTopic.class, CvTopic.CC_NOTE).equals(annotation.getCvTopic())) { if (notes == null) { notes = new ArrayList<String>(2); // should rarely have more than 2 } notes.add(annotation.getAnnotationText()); } } return notes; }
if (uniprotCcExport.equals(_annotation.getCvTopic())) {
if (drExport.equals(annotation.getCvTopic())) {
if (getCvContext().getByLabel(CvTopic.class, CvTopic.UNIPROT_DR_EXPORT).equals(annotation.getCvTopic())) {
/** * Loads all CvTopics that should not be shown on the public interface. */ private AnnotationFilter() { logger.debug( "Initializing which CvTopic should be filtered out." ); // search for the CvTopic no-export CvTopic noExport = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotatedObjectDao( CvTopic.class ).getByShortLabel( CvTopic.NO_EXPORT ); if ( noExport != null ) { // load all CvTopics Collection<CvTopic> cvTopics = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao( CvTopic.class ).getAll(); // select those that have an Annotation( no-export ) for ( CvTopic cvTopic : cvTopics ) { for ( Annotation annotation : cvTopic.getAnnotations() ) { if ( noExport.equals( annotation.getCvTopic() ) ) { if ( filteredTopics == null ) { filteredTopics = new HashSet<CvTopic>( 8 ); } logger.debug( "CvTopic( " + cvTopic.getShortLabel() + " )" ); filteredTopics.add( cvTopic ); } } } } if ( filteredTopics == null ) { filteredTopics = Collections.EMPTY_SET; } logger.debug( filteredTopics.size() + " CvTopic" + ( filteredTopics.size() > 1 ? "s" : "" ) + " filtered." ); }
out.println("\t\t\t\tAnnotation CvTopic: " + _annotation.getCvTopic()); if (drExport.equals(_annotation.getCvTopic())) {
if (getCvContext().getByLabel(CvTopic.class, CvTopic.UNIPROT_DR_EXPORT).equals(_annotation.getCvTopic())) {
final Annotation annotation = (Annotation) iterator3.next(); if (authorConfidenceTopic.equals(annotation.getCvTopic())) { String text = annotation.getAnnotationText();