Exemple #1
0
  @Test
  @SuppressWarnings("unchecked")
  public void testFilter() throws Exception {

    Collection<Annotation> annotations =
        Arrays.asList(
            TopScoreFilterTest.create("1.1.1.1", 500, 550, 900),
            TopScoreFilterTest.create("1.1.1.2", 500, 450, 700),
            TopScoreFilterTest.create("1.1.1.85", 500, 450, 1050));

    AnnotationFilter filter = new ThresholdFilter(750);

    Collection<Annotation> filtered = filter.filter(annotations);

    Assert.assertEquals(2, filtered.size());
  }
Exemple #2
0
  @Test
  public void testSingleHighScore() throws Exception {

    Collection<Annotation> annotations =
        Arrays.asList(
            create("1.1.1.1", 500, 550, 450),
            create("1.1.1.2", 700, 750, 650),
            create("1.1.1.85", 1000, 990, 790));
    Collection<Annotation> filtered = filter.filter(annotations);
    Assert.assertEquals(1, filtered.size());

    Annotation annotation = filtered.iterator().next();
    String accession = ((EnzymeClassification) annotation).getIdentifier().getAccession();

    Assert.assertEquals("1.1.1.85", accession);
  }
Exemple #3
0
  @Test
  public void testMultipleHighScores() throws Exception {

    Collection<Annotation> annotations =
        Arrays.asList(
            create("1.1.1.1", 500, 550, 450),
            create("1.1.1.2", 700, 750, 650),
            create("1.1.1.-", 550, 750));

    Collection<Annotation> filtered = filter.filter(annotations);

    Assert.assertEquals(2, filtered.size());

    Set<String> accessions = new HashSet<String>(5);
    for (Annotation annotation : filtered) {
      accessions.add(((EnzymeClassification) annotation).getIdentifier().getAccession());
    }

    Assert.assertTrue(accessions.contains("1.1.1.-"));
    Assert.assertTrue(accessions.contains("1.1.1.2"));
    Assert.assertFalse(accessions.contains("1.1.1.1"));
  }