本文整理了Java中org.opencb.commons.datastore.core.Query.toJson
方法的一些代码示例,展示了Query.toJson
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.toJson
方法的具体详情如下:
包路径:org.opencb.commons.datastore.core.Query
类名称:Query
方法名:toJson
暂无
代码示例来源:origin: opencb/opencga
private void display(Query query, QueryOptions queryOptions, SolrQuery solrQuery) {
System.out.println("Query : " + query.toJson());
System.out.println("Query options: " + queryOptions.toJson());
System.out.println("Solr query : " + solrQuery.toString());
System.out.println();
}
}
代码示例来源:origin: opencb/opencga
private void checkCanExecuteNativeQuery(Query query) {
String message = "Query " + (query == null ? null : query.toJson()) + " is not fully supported";
try {
assumeTrue(message, VariantHBaseQueryParser.isSupportedQuery(query));
} catch (AssumptionViolatedException e) {
System.out.println(message);
throw e;
}
}
代码示例来源:origin: opencb/opencga
@Override
public VariantQueryResult<Variant> get(Query query, QueryOptions options) {
logger.info("Query " + query.toJson());
logger.info("QueryOptions " + options.toJson());
logger.info("dbName " + dbName);
List<Variant> variants = new ArrayList<>();
iterator(query, options).forEachRemaining(variants::add);
return new VariantQueryResult<>("", 0, variants.size(), variants.size(), "", "", variants, null,
DummyVariantStorageEngine.STORAGE_ENGINE_ID);
}
代码示例来源:origin: opencb/opencga
logger.info("Query : {} ", query.toJson());
annotationFile = createAnnotation(
Paths.get(params.getString(OUT_DIR, "/tmp")),
代码示例来源:origin: opencb/opencga
throw e;
} else {
throw new CatalogDBException("Error parsing query : " + query.toJson(), e);
代码示例来源:origin: opencb/opencga
protected void check(String collection, Query query, QueryOptions options) throws StorageEngineException {
assertEquals(query.toJson() + " " + options.toJson(), collection, VariantSearchUtils.inferSpecificSearchIndexSamplesCollection(query, options, variantStorageEngine.getStudyConfigurationManager(), DB_NAME));
}
代码示例来源:origin: opencb/opencga
@Test
public void queriesWithRelease() throws Exception {
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.SAMPLE.key(), "sample2").append(VariantQueryParam.RELEASE.key(), 2), sessionId).toJson());
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.SAMPLE.key(), "sample2").append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson());
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.INCLUDE_SAMPLE.key(), "sample2").append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson());
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.FILE.key(), "file1.vcf").append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson());
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.STATS_MAF.key(), "c1>0.1").append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson());
System.out.println(queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(VariantQueryParam.GENOTYPE.key(), "sample1:HOM_ALT,sample2:HET_REF").append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson());
}
代码示例来源:origin: opencb/opencga
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,
// not(hasAnyGeneOf(genes)),
hasSO(hasItem(so))
)))));
}
代码示例来源:origin: opencb/opencga
result.setResponseMessage(query.toJson());
result.setResponseCodeOK();
result.sampleStart();
代码示例来源:origin: opencb/opencga
protected VariantQueryResult<Variant> query(Query query, QueryOptions options) {
try {
query = preProcessQuery(query, options);
StudyConfigurationManager scm = dbAdaptor.getStudyConfigurationManager();
String collection = VariantSearchUtils.inferSpecificSearchIndexSamplesCollection(query, options, scm, DB_NAME);
// Do not execute this test if the query is not covered by the specific search index collection
Assume.assumeThat(query.toJson(), collection, CoreMatchers.notNullValue());
if (options.getInt(QueryOptions.LIMIT, 0) <= 0) {
options = new QueryOptions(options);
options.put(QueryOptions.LIMIT, 100000);
}
return variantStorageEngine.getVariantSearchManager().query(collection, query, options);
} catch (StorageEngineException | VariantSearchException | IOException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
return null;
}
代码示例来源:origin: opencb/opencga
@Test
public void fileWrongNameWithRelease() throws Exception {
thrown.expectMessage("not found");
thrown.expect(CatalogException.class);
queryUtils.parseQuery(new Query(VariantQueryParam.FILE.key(), "non_existing_file.vcf")
.append(VariantQueryParam.STUDY.key(), "s1"), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void includeSampleWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.INCLUDE_SAMPLE, "sample3", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.INCLUDE_SAMPLE.key(), "sample3")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void fileWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.FILE, "file3.vcf", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.FILE.key(), "file3.vcf")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void cohortWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.COHORT, "c2", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.COHORT.key(), "c2")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void sampleWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.SAMPLE, "sample3", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.SAMPLE.key(), "sample3")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void cohortStatsWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.STATS_MAF, "c2", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.STATS_MAF.key(), "c2>0.2")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void includeFileWrongRelease() throws Exception {
VariantQueryException e = VariantCatalogQueryUtils.wrongReleaseException(VariantQueryParam.INCLUDE_FILE, "file3.vcf", 1);
thrown.expectMessage(e.getMessage());
thrown.expect(e.getClass());
queryUtils.parseQuery(new Query(VariantQueryParam.INCLUDE_FILE.key(), "file3.vcf")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void sampleNotFound() throws Exception {
thrown.expectMessage("not found");
thrown.expect(CatalogException.class);
queryUtils.parseQuery(new Query(VariantQueryParam.SAMPLE.key(), "sample_not_exists")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void fileNotFound() throws Exception {
thrown.expectMessage("not found");
thrown.expect(CatalogException.class);
queryUtils.parseQuery(new Query(VariantQueryParam.FILE.key(), "non_existing_file.vcf")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
代码示例来源:origin: opencb/opencga
@Test
public void fileNotIndexed() throws Exception {
thrown.expectMessage("not indexed");
thrown.expect(VariantQueryException.class);
queryUtils.parseQuery(new Query(VariantQueryParam.FILE.key(), "file5.vcf")
.append(VariantQueryParam.STUDY.key(), "s1")
.append(VariantQueryParam.RELEASE.key(), 1), sessionId).toJson();
}
内容来源于网络,如有侵权,请联系作者删除!