Codota Logo
VariantMatchers.everyResult
Code IndexAdd Codota to your IDE (free)

How to use
everyResult
method
in
org.opencb.opencga.storage.core.variant.adaptors.VariantMatchers

Best Java code snippets using org.opencb.opencga.storage.core.variant.adaptors.VariantMatchers.everyResult (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: opencb/opencga

public static <T> Matcher<QueryResult<T>> everyResult(List<T> allValues, Matcher<T> subMatcher) {
  long count = count(allValues, subMatcher);
  Set<T> expectValues = filter(allValues, subMatcher);
  return allOf(numResults(expectValues), everyResult(subMatcher));
}
origin: opencb/opencga

@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))))));
}
origin: opencb/opencga

@Test
public void testIncludeStudiesAll() throws Exception {
  query = new Query(VariantQueryParam.INCLUDE_STUDY.key(), ALL);
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query(), options);
  assertThat(queryResult, everyResult(allVariants, notNullValue(Variant.class)));
}
origin: opencb/opencga

public void checkRegion(Region queryRegion, Region overlappingRegion) {
  queryResult = query(new Query(REGION.key(), queryRegion), null);
  assertThat(queryResult, everyResult(allVariants, overlaps(overlappingRegion)));
}
origin: opencb/opencga

@Test
public void testGetAllVariants_samples_gt() {
  Query query = new Query(SAMPLE.key(), "NA19600").append(GENOTYPE.key(), "NA19685" + IS + homRef).append(INCLUDE_SAMPLE.key(), ALL);
  thrown.expect(VariantQueryException.class);
  thrown.expectMessage("Can not be used along with filter \"genotype\"");
  queryResult = query(query, new QueryOptions());
  assertThat(queryResult, everyResult(allVariants, withStudy(STUDY_NAME, allOf(
      withSampleData("NA19600", "GT", containsString("1")),
      withSampleData("NA19685", "GT", is(homRef))))));
}
origin: opencb/opencga

@Test
public void testIncludeStudies() throws Exception {
  query = new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1");
  this.queryResult = query(query, options);
  assertEquals(dbAdaptor.count(null).first().intValue(), this.queryResult.getNumResults());
  assertThat(this.queryResult, everyResult(allOf(withStudy("S_2", nullValue()), withStudy("S_3", nullValue()), withStudy("S_4", nullValue()))));
}
origin: opencb/opencga

@Test
public void testIncludeStudiesNone() throws Exception {
  query = new Query(VariantQueryParam.INCLUDE_STUDY.key(), NONE);
  queryResult = query(query, options);
  assertEquals(dbAdaptor.count(null).first().intValue(), queryResult.getNumResults());
  assertThat(queryResult, everyResult(firstStudy(nullValue())));
}
origin: opencb/opencga

@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))))));
}
origin: opencb/opencga

@Test
public void testGetAllVariants_genes() {
  Query query = new Query(GENE.key(), "FLG-AS1");
  QueryResult<Variant> result = query(query, new QueryOptions());
  assertThat(result, everyResult(allVariants, hasAnnotation(hasGenes(Collections.singletonList("FLG-AS1")))));
  for (Variant variant : result.getResult()) {
    System.out.println("variant = " + variant);
  }
  query = new Query(GENE.key(), "WRONG_GENE");
  VariantQueryException exception = VariantQueryException.geneNotFound("WRONG_GENE");
  thrown.expect(exception.getClass());
  thrown.expectMessage(exception.getMessage());
  result = query(query, new QueryOptions());
}
origin: opencb/opencga

@Test
public void testGetByStudiesNegated() throws Exception {
  query = new Query()
      .append(VariantQueryParam.STUDY.key(), "S_1" + AND + NOT + "S_2");
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1,S_2"), options);
  assertThat(queryResult, everyResult(allVariants, allOf(withStudy("S_1"), not(withStudy("S_2")))));
}
origin: opencb/opencga

@Test
public void testGetAllVariants_populationFrequencyRef() {
  final PopulationFrequency defaultPopulation = new PopulationFrequency(null, null, null, null, 0F, 0F, 0F, 0F, 0F);
  Query query;
  query = new Query()
      .append(ANNOT_POPULATION_REFERENCE_FREQUENCY.key(), GENOMES_PHASE_3 + ":AFR<=0.05001");
  queryResult = query(query, options);
  assertThat(queryResult, everyResult(allVariants, hasAnnotation(hasPopRefFreq(GENOMES_PHASE_3, "AFR", lte(0.05001)))));
}
origin: opencb/opencga

@Test
public void testGetByFilterByIncludeSample() {
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), sampleNA12877)
      .append(VariantQueryParam.INCLUDE_FILE.key(), asList(file12877)), options);
  query = new Query()
      .append(VariantQueryParam.STUDY.key(), "S_1")
      .append(VariantQueryParam.FILTER.key(), "LowGQX;LowMQ")
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), sampleNA12877);
  queryResult = query(query, options);
  assertThat(queryResult, everyResult(allVariants, withStudy("S_1",
      withFileId(file12877, withAttribute(FILTER, allOf(containsString("LowGQX"), containsString("LowMQ")))))));
}
origin: opencb/opencga

@Test
public void testGetByStudies() throws Exception {
  query = new Query()
      .append(VariantQueryParam.STUDY.key(), "S_1");
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1"), options);
  assertThat(queryResult, everyResult(allVariants, withStudy("S_1")));
}
origin: opencb/opencga

@Test
public void testGetByFileNamesMultiStudiesImplicitAnd() {
  query = new Query()
      .append(VariantQueryParam.FILE.key(),
          file12877
              + AND +
              file12882);
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12882")
      .append(VariantQueryParam.INCLUDE_FILE.key(), asList(file12877 , file12882)), options);
  assertThat(queryResult, everyResult(allVariants, allOf(withStudy("S_1", withFileId(file12877)), withStudy("S_2", withFileId(file12882)))));
}
origin: opencb/opencga

@Test
public void testGetByFileNamesMultiStudiesImplicitOr() {
  query = new Query()
      .append(VariantQueryParam.FILE.key(),
          file12877
              + OR +
              file12882);
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12882")
      .append(VariantQueryParam.INCLUDE_FILE.key(), asList(file12877 , file12882)), options);
  assertThat(queryResult, everyResult(allVariants, anyOf(withStudy("S_1", withFileId(file12877)), withStudy("S_2", withFileId(file12882)))));
}
origin: opencb/opencga

@Test
public void testGetBySampleName() throws Exception {
  query = new Query()
      .append(VariantQueryParam.STUDY.key(), "S_1")
      .append(VariantQueryParam.SAMPLE.key(), "NA12877");
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
      .append(VariantQueryParam.INCLUDE_FILE.key(), file12877), options);
  assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId(file12877), withSampleData("NA12877", "GT", containsString("1"))))));
}
origin: opencb/opencga

private void checkQueryGenotypes(VariantHadoopDBAdaptor dbAdaptor) {
  StudyConfiguration sc = dbAdaptor.getStudyConfigurationManager().getStudyConfiguration(STUDY_ID, null).first();
  List<Variant> allVariants = dbAdaptor.get(new Query(), new QueryOptions()).getResult();
  for (String sample : StudyConfiguration.getIndexedSamples(sc).keySet()) {
    VariantQueryResult<Variant> queryResult = dbAdaptor.get(new Query(VariantQueryParam.SAMPLE.key(), sample)
        .append(VariantQueryParam.INCLUDE_SAMPLE.key(), VariantQueryUtils.ALL)
        .append(VariantQueryParam.INCLUDE_FILE.key(), VariantQueryUtils.ALL), new QueryOptions("explain", true));
    assertThat(queryResult, everyResult(allVariants,
        withStudy(STUDY_NAME,
            withSampleData(sample, "GT", containsString("1")))));
  }
}
origin: opencb/opencga

  public void testGetBySampleName(String expectedSource, QueryOptions options) throws Exception {
    query = new Query()
        .append(VariantQueryParam.STUDY.key(), "S_1")
        .append(VariantQueryParam.SAMPLE.key(), "NA12877");
//        queryResult = dbAdaptor.get(query, options);
    queryResult = variantStorageEngine.get(query, options);
    VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
        .append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
        .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
        .append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
    assertEquals(expectedSource, queryResult.getSource());
    assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), withSampleData("NA12877", "GT", containsString("1"))))));
  }

origin: opencb/opencga

  public void testGetByFileName(String expectedSource, QueryOptions options) throws Exception {
    query = new Query()
//                .append(VariantQueryParam.STUDY.key(), "S_1")
        .append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
//        queryResult = dbAdaptor.get(query, options);
    queryResult = variantStorageEngine.get(query, options);
    VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
        .append(VariantQueryParam.INCLUDE_STUDY.key(), "all")
        .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
        .append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
    assertEquals(expectedSource, queryResult.getSource());
    assertThat(queryResult, everyResult(allVariants, withStudy("S_1", withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"))));
  }

origin: opencb/opencga

@Test
public void testGetByFileName() throws Exception {
  query = new Query()
      .append(VariantQueryParam.STUDY.key(), "S_1")
      .append(VariantQueryParam.FILE.key(), file12877);
  queryResult = query(query, options);
  VariantQueryResult<Variant> allVariants = dbAdaptor.get(new Query()
      .append(VariantQueryParam.INCLUDE_STUDY.key(), "all")
      .append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
      .append(VariantQueryParam.INCLUDE_FILE.key(), file12877), options);
  assertThat(queryResult, everyResult(allVariants, withStudy("S_1", withFileId(file12877))));
}
org.opencb.opencga.storage.core.variant.adaptorsVariantMatcherseveryResult

Popular methods of VariantMatchers

  • overlaps
  • withFileId
  • withSampleData
  • withStudy
  • asNumber
  • at
  • count
  • filter
  • firstStudy
  • gt
  • gte
  • hasAnnotation
  • gte,
  • hasAnnotation,
  • hasAnyGeneOf,
  • hasAnyPolyphen,
  • hasAnyPolyphenDesc,
  • hasAnySift,
  • hasAnySiftDesc,
  • hasGenes,
  • hasPolyphen

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • addToBackStack (FragmentTransaction)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • ImageIO (javax.imageio)
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now