GeneSetUtil { public static boolean matchesGeneSetCategoryOrGeneSetValue(SemanticQuery geneQuery) { if (geneQuery.isEmpty() || geneQuery.size() > 1) { return false; } SemanticQueryTerm term = geneQuery.iterator().next(); return term.category().isPresent() ? hasGeneSetCategory(term.category().get()) : matchesGeneSetAccession(term.value()); } protected  GeneSetUtil(); static boolean matchesInterProAccession(String identifier); static boolean matchesGeneOntologyAccession(String identifier); static boolean matchesPlantOntologyAccession(String identifier); static boolean matchesReactomeID(String identifier); static boolean matchesPlantReactomeID(String identifier); static boolean matchesGeneSetAccession(String identifier); static boolean matchesGeneSetCategoryOrGeneSetValue(SemanticQuery geneQuery);  }
@Test public void testIsGeneSet() { assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_REACTOME_CATEGORY), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_INTERPRO_CATEGORY), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_GO_CATEGORY), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_PO_CATEGORY), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_REACTOME_VALUE), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_INTERPRO_VALUE), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_GO_VALUE), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_PO_VALUE), is(true)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_PLANT_REACTOME_VALUE), is(true)); }
@Test public void multiTermQuery() { assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_GENE_SET_CATEGORIES), is(false)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENE_QUERY_WITH_GENE_SET_VALUES), is(false)); }
@Test public void emptyQuery() { assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(GENERIC_GENE_QUERY), is(false)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(TRICKY_GENE_QUERY), is(false)); assertThat(GeneSetUtil.matchesGeneSetCategoryOrGeneSetValue(EMPTY_QUERY), is(false)); }