private void queryGeneCT(String gene, String so, Query query, Matcher<VariantAnnotation> regionMatcher) {
logger.info(query.toJson());
queryResult = query(query, null);
logger.info(" -> numResults " + queryResult.getNumResults());
Matcher<String> geneMatcher;
List<String> genes = Arrays.asList(gene.split(","));
if (gene.contains(",")) {
geneMatcher = anyOf(genes.stream().map(CoreMatchers::is).collect(Collectors.toList()));
} else {
geneMatcher = is(gene);
}
assertThat(queryResult, everyResult(allVariants, hasAnnotation(
anyOf(
allOf(
hasAnyGeneOf(genes),
withAny("consequence type", VariantAnnotation::getConsequenceTypes, allOf(
with("gene", ConsequenceType::getGeneName, geneMatcher),
withAny("SO", ConsequenceType::getSequenceOntologyTerms,
with("accession", SequenceOntologyTerm::getAccession, is(so))))))
,
allOf(
regionMatcher,
hasSO(hasItem(so))
)))));
}