GoNoISSProteinBindingRule extends AbstractAnnotationRule { @Override public Set<AnnotationRuleViolation> getRuleViolations(GeneAnnotation a) { String cls = a.getCls(); if (cls != null && "GO:0005515".equals(cls)) { String evidence = a.getShortEvidence(); if (evidences.contains(evidence)) { AnnotationRuleViolation violation = new AnnotationRuleViolation(getRuleId(), message, a, violationType); return Collections.singleton(violation); } } return null; } GoNoISSProteinBindingRule(TraversingEcoMapper eco, ViolationType violationType);  GoNoISSProteinBindingRule(TraversingEcoMapper eco); @Override Set<AnnotationRuleViolation> getRuleViolations(GeneAnnotation a); static final String PERMANENT_JAVA_ID; }
@Test public void test() throws Exception { GafDocument gafdoc = loadGaf("test_gene_association_mgi.gaf"); AnnotationRule rule = new GoNoISSProteinBindingRule(eco); List<GeneAnnotation> annotations = gafdoc.getGeneAnnotations(); List<AnnotationRuleViolation> allViolations = new ArrayList<AnnotationRuleViolation>(); for (GeneAnnotation annotation : annotations) { Set<AnnotationRuleViolation> violations = rule.getRuleViolations(annotation); if (violations != null && !violations.isEmpty()) { allViolations.addAll(violations); } } assertEquals(0, allViolations.size()); }