@Test public void testGetNotFromSearch() throws Exception { Query query = new Query(ANNOT_PROTEIN_SUBSTITUTION.key(), "sift>0.1"); VariantQueryResult<Variant> result = variantStorageEngine.get(query, new QueryOptions()); verify(solrClient, never()).query(anyString(), any()); assertThat(result, everyResult(allVariants, hasAnnotation(hasSift(hasItem(gt(0.1)))))); }
@Test public void testGetAllVariants_mgf() throws Exception { queryResult = query(new Query(STATS_MGF.key(), STUDY_NAME + ":ALL>0.2"), null); System.out.println(queryResult.getNumResults()); assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, withStats("ALL", withMgf(gt(0.2)))))); queryResult = query(new Query(STATS_MGF.key(), STUDY_NAME + ":ALL<0.2"), null); System.out.println(queryResult.getNumResults()); assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, withStats("ALL", withMgf(lt(0.2)))))); }
queryResult = query(query, null); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasSO(hasItem("SO:0001566"))))); assertThat(queryResult, numResults(gt(0))); queryResult = query(query, null); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasSO(hasItem("SO:0001566"))))); assertThat(queryResult, numResults(gt(0))); queryResult = query(query, options); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasSO(anyOf(hasItem("SO:0001566"), hasItem("SO:0001583")))))); assertThat(queryResult, numResults(gt(0))); queryResult = query(query, options); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasSO(anyOf(hasItem("SO:0001566"), hasItem("SO:0001583")))))); assertThat(queryResult, numResults(gt(0))); assertThat(queryResult, numResults(gt(0))); queryResult = query(query, options); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasSO(allOf(hasItem("SO:0001566"), hasItem("SO:0001583")))))); assertThat(queryResult, numResults(gt(0)));
System.out.println(allVariants.first().toJson()); assertThat(queryResult, everyResult(allVariants, withStudy("S_1", withFileId(file12877, with(QUAL, fileEntry -> fileEntry.getAttributes().get(QUAL), allOf(notNullValue(), with("", Double::valueOf, gt(50))))))));
.append(ANNOT_POPULATION_ALTERNATE_FREQUENCY.key(), ESP_6500 + ":AA>0.05001"); queryResult = query(query, options); assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasPopAltFreq(ESP_6500, "AA", gt(0.05001))))); queryResult = query(query, options); assertThat(queryResult, everyResult(allVariants, hasAnnotation(allOf( hasPopAltFreq(ESP_6500, "AA", gt(0.05001)), hasPopAltFreq(GENOMES_PHASE_3, "AFR", lte(0.05001)))))); hasPopAltFreq(ESP_6500, "AA", gt(0.05001)), hasPopAltFreq(GENOMES_PHASE_3, "AFR", lte(0.05001))))));
assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, withStats(StudyEntry.DEFAULT_COHORT, withMaf(gt(0.2)))))); int expectedCount = (int) VariantMatchers.count(allVariants.getResult(), withStudy(STUDY_NAME, withStats("cohort1", withMaf(gt(0.2))))); numResults = count(new Query(STATS_MAF.key(), STUDY_NAME + ":cohort1>0.2")); assertEquals(expectedCount, numResults); queryResult = query(new Query(STUDY.key(), 1).append(STATS_MAF.key(), "10>0.2"), null); assertEquals(expectedCount, queryResult.getNumResults()); assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, withStats("cohort1", withMaf(gt(0.2)))))); assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, withStats("cohort2", withMaf(gt(0.2)))))); withStats("cohort2", withMaf(gt(0.2))), withStats("cohort1", withMaf(lt(0.2))))))); withStats("cohort2", withMaf(gt(0.2))), withStats("cohort1", withMaf(lt(0.2)))))));
@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))) ) ) )))); }