throw VariantQueryException.mixedAndOrOperators(); } else { throw VariantQueryException.mixedAndOrOperators(param, value);
throw VariantQueryException.mixedAndOrOperators(param, stringValue); } else { operation = QueryOperation.AND; throw VariantQueryException.mixedAndOrOperators(param, stringValue); } else { operation = QueryOperation.OR;
QueryOperation fileOperator = checkOperator(query.getString(FILE.key())); if (fileOperator != null && pair.getKey() != fileOperator) { throw VariantQueryException.mixedAndOrOperators(FILE, INFO); throw VariantQueryException.mixedAndOrOperators(FORMAT, genotypeParam);
@Test public void testGetAllVariants_mixInfoFileOperators() { VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query() .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1") .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878") .append(VariantQueryParam.INCLUDE_FILE.key(), file12877 + "," + file12878), options); thrown.expect(VariantQueryException.class); thrown.expectMessage(VariantQueryException.mixedAndOrOperators(FILE, INFO).getMessage()); query = new Query(STUDY.key(), "S_1") .append(FILE.key(), file12877 + OR + file12878) .append(INFO.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz:HaplotypeScore<10" + AND + "1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz:DP>100"); queryResult = query(query, new QueryOptions()); System.out.println("queryResult.getNumResults() = " + queryResult.getNumResults()); assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf( withFileId(file12877, withAttribute("HaplotypeScore", asNumber(lt(10))) ), withFileId(file12878, withAttribute("DP", asNumber(gt(100))) ) )))); }
@Test public void testGetAllVariants_mixInfoFileOperators2() { VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query() .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1") .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878") .append(VariantQueryParam.INCLUDE_FILE.key(), file12877 + "," + file12878), options); thrown.expect(VariantQueryException.class); thrown.expectMessage(VariantQueryException.mixedAndOrOperators(FILE, INFO).getMessage()); query = new Query(STUDY.key(), "S_1") .append(FILE.key(), file12877 + AND + file12878) .append(INFO.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz:HaplotypeScore<10" + OR + "1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz:DP>100"); queryResult = query(query, new QueryOptions()); System.out.println("queryResult.getNumResults() = " + queryResult.getNumResults()); assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf( withFileId(file12877), withFileId(file12878), anyOf( withFileId(file12877, withAttribute("HaplotypeScore", asNumber(lt(10))) ), withFileId(file12878, withAttribute("DP", asNumber(gt(100))) ) ) )))); }