org.opencb.commons.datastore.core.Query.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.opencb.commons.datastore.core.Query.<init>方法的一些代码示例,展示了Query.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>方法的具体详情如下:
包路径:org.opencb.commons.datastore.core.Query
类名称:Query
方法名:<init>

Query.<init>介绍

暂无

代码示例

代码示例来源:origin: opencb/opencga

@Override
public void delete(long id) throws CatalogDBException {
  Query query = new Query(QueryParams.ID.key(), id);
  delete(query);
}

代码示例来源:origin: opencb/opencga

@Override
public void delete(long id) throws CatalogDBException {
  Query query = new Query(QueryParams.UID.key(), id);
  delete(query);
}

代码示例来源:origin: opencb/opencga

@Override
public void delete(long id) throws CatalogDBException {
  Query query = new Query(QueryParams.UID.key(), id);
  delete(query);
}

代码示例来源:origin: opencb/opencga

@Override
public long getStudyId(long jobId) throws CatalogDBException {
  Query query = new Query(QueryParams.UID.key(), jobId);
  QueryOptions queryOptions = new QueryOptions(MongoDBCollection.INCLUDE, PRIVATE_STUDY_ID);
  QueryResult<Document> queryResult = nativeGet(query, queryOptions);
  if (queryResult.getNumResults() != 0) {
    Object id = queryResult.getResult().get(0).get(PRIVATE_STUDY_ID);
    return id instanceof Number ? ((Number) id).longValue() : Long.parseLong(id.toString());
  } else {
    throw CatalogDBException.uidNotFound("Job", jobId);
  }
}

代码示例来源:origin: opencb/opencga

public QueryResult<ProjectMetadata.VariantAnnotationMetadata> getAnnotationMetadata(String name, String project, String sessionId)
    throws StorageEngineException, CatalogException, IOException {
  Query query = new Query(VariantCatalogQueryUtils.PROJECT.key(), project);
  return secure(query, empty(), sessionId, (engine) -> engine.getAnnotationMetadata(name));
}

代码示例来源:origin: opencb/opencga

@Override
public QueryResult<Study> get(long studyId, QueryOptions options) throws CatalogDBException {
  checkId(studyId);
  Query query = new Query(QueryParams.UID.key(), studyId).append(QueryParams.STATUS_NAME.key(), "!=" + Status.DELETED);
  return get(query, options);
}

代码示例来源:origin: opencb/opencga

@Override
public QueryResult<Dataset> update(long id, ObjectMap parameters, QueryOptions queryOptions) throws CatalogDBException {
  long startTime = startQuery();
  update(new Query(QueryParams.ID.key(), id), parameters, QueryOptions.empty());
  return endQuery("Update dataset", startTime, get(id, new QueryOptions()));
}

代码示例来源:origin: opencb/opencga

/**
 * At the moment it does not clean external references to itself.
 */
@Override
public QueryResult<Job> get(long jobId, QueryOptions options) throws CatalogDBException {
  checkId(jobId);
  Query query = new Query(QueryParams.UID.key(), jobId).append(QueryParams.STATUS_NAME.key(), "!=" + Status.DELETED)
      .append(QueryParams.STUDY_UID.key(), getStudyId(jobId));
  return get(query, options);
}

代码示例来源:origin: opencb/opencga

private Document getStudyDocument(Query query) throws CatalogDBException {
  // Get the study document
  Query studyQuery = new Query(StudyDBAdaptor.QueryParams.UID.key(), query.getLong(QueryParams.STUDY_UID.key()));
  QueryResult<Document> queryResult = dbAdaptorFactory.getCatalogStudyDBAdaptor().nativeGet(studyQuery, QueryOptions.empty());
  if (queryResult.getNumResults() == 0) {
    throw new CatalogDBException("Study " + query.getLong(QueryParams.STUDY_UID.key()) + " not found");
  }
  return queryResult.first();
}

代码示例来源:origin: opencb/opencga

@Test
public void parseConsequenceTypeSOAcc() {
  QueryOptions queryOptions = new QueryOptions();
  Query query = new Query();
  query.put(ANNOT_CONSEQUENCE_TYPE.key(), "SO:0001792,SO:0001619");
  SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
  display(query, queryOptions, solrQuery);
  assertEquals(flDefault1 + "&q=*:*&fq=soAcc:\"1792\"+OR+soAcc:\"1619\"", solrQuery.toString());
}

代码示例来源:origin: opencb/opencga

@Test
public void parsePopMafScoreMissing() {
  QueryOptions queryOptions = new QueryOptions();
  Query query = new Query();
  // (* -popFreq__1kG_phase3__YRI:*) OR popFreq_1kG_phase3__YRI:[0.01 TO *]
  query.put(ANNOT_POPULATION_MINOR_ALLELE_FREQUENCY.key(), "1kG_phase3:YRI<<0.01");
  SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
  display(query, queryOptions, solrQuery);
  assertEquals(flDefault1 + "&q=*:*&fq=(popFreq__1kG_phase3__YRI:[0+TO+0.01}+OR+(*+-popFreq__1kG_phase3__YRI:*))", solrQuery.toString());
}

代码示例来源:origin: opencb/opencga

@Test
public void parseNoPopMaf() {
  QueryOptions queryOptions = new QueryOptions();
  Query query = new Query();
  query.put(ANNOT_POPULATION_MINOR_ALLELE_FREQUENCY.key(), "1kG_phase3:GWD!=0.061946902");
  SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
  display(query, queryOptions, solrQuery);
  assertEquals(flDefault1 + "&q=*:*&fq=-popFreq__1kG_phase3__GWD:0.061946902", solrQuery.toString());
}

代码示例来源:origin: opencb/opencga

@Test
public void testQueryExcludeStudies() throws Exception {
  Query query = new Query(VariantQueryParam.STUDY.key(), studyId);
  QueryOptions queryOptions = new QueryOptions(QueryOptions.EXCLUDE, VariantField.STUDIES);
  Map<String, List<Sample>> longListMap = variantManager.checkSamplesPermissions(query, queryOptions, mockVariantDBAdaptor().getStudyConfigurationManager(), sessionId);
  Assert.assertEquals(Collections.emptyMap(), longListMap);
}

代码示例来源:origin: opencb/opencga

@Test
public void queryByPanel() throws Exception {
  Query query = queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(PANEL.key(), "MyPanel"), sessionId);
  assertEquals(Arrays.asList("BRCA2","CADM1","CTBP2P1","ADSL"), query.getAsList(GENE.key()));
  query = queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(PANEL.key(), "MyPanel").append(GENE.key(), "ASDF"), sessionId);
  assertEquals(Arrays.asList("BRCA2","CADM1","CTBP2P1","ADSL", "ASDF"), query.getAsList(GENE.key()));
}

代码示例来源:origin: opencb/opencga

@Test
public void testIteratorSamples() throws CatalogException {
  Query query = new Query();
  DBIterator<Sample> iterator = catalogManager.getSampleManager().iterator(studyFqn, query, null, sessionIdUser);
  int count = 0;
  while (iterator.hasNext()) {
    iterator.next();
    count++;
  }
  assertEquals(9, count);
}

代码示例来源:origin: opencb/opencga

@Test
public void parseAnnotCT1() {
  QueryOptions queryOptions = new QueryOptions();
  Query query = new Query();
  // consequence types and genes
  // no xrefs or regions: genes AND cts
  query.put(ANNOT_CONSEQUENCE_TYPE.key(), "missense_variant,coding_sequence_variant");
  query.put(ANNOT_XREF.key(), "RIPK2,NCF4");
  SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
  display(query, queryOptions, solrQuery);
  assertEquals(flDefault1 + "&q=*:*&fq=geneToSoAcc:\"RIPK2_1583\"+OR+geneToSoAcc:\"RIPK2_1580\"+OR+geneToSoAcc:\"NCF4_1583\"+OR+geneToSoAcc:\"NCF4_1580\"", solrQuery.toString());
}

代码示例来源:origin: opencb/opencga

@Test
public void parseAnnotCT4() {
  QueryOptions queryOptions = new QueryOptions();
  Query query = new Query();
  // no consequence types: (xrefs OR regions) but we must add "OR genes", i.e.: xrefs OR regions OR genes
  // we must make an OR with xrefs, genes and regions and add it to the "AND" filter list
  query.put(REGION.key(), "1,2");
  query.put(ANNOT_XREF.key(), "RIPK2,NCF4");
  SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
  display(query, queryOptions, solrQuery);
  assertEquals(flDefault1 + "&q=*:*&fq=xrefs:\"RIPK2\"+OR+xrefs:\"NCF4\"+OR+(chromosome:\"1\")+OR+(chromosome:\"2\")", solrQuery.toString());
}

代码示例来源: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 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();
}

代码示例来源:origin: opencb/opencga

@Test
public void testGetAllJobs() throws CatalogException {
  Query query = new Query(StudyDBAdaptor.QueryParams.OWNER.key(), "user");
  String studyId = catalogManager.getStudyManager().get(query, null, sessionIdUser).first().getId();
  catalogManager.getJobManager().create(studyId, new Job().setId("myErrorJob").setToolId("samtools"), null, sessionIdUser);
  QueryResult<Job> allJobs = catalogManager.getJobManager().get(studyId, (Query) null, null, sessionIdUser);
  assertEquals(1, allJobs.getNumTotalResults());
  assertEquals(1, allJobs.getNumResults());
}

相关文章