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

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

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

Query.get介绍

暂无

代码示例

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

@GET
@Path("/{transcriptId}/variation")
@ApiOperation(httpMethod = "GET", value = "To be fixed", hidden = true)
public Response getVariationsByTranscriptId(@PathParam("transcriptId") String id) {
  try {
    parseQueryParams();
    VariantDBAdaptor variationDBAdaptor = dbAdaptorFactory.getVariationDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(id, TranscriptDBAdaptor.QueryParams.XREFS.key());
    List<QueryResult> queryResultList = variationDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResultList.get(i).setId((String) queries.get(i).get(TranscriptDBAdaptor.QueryParams.XREFS.key()));
    }
    return createOkResponse(queryResultList);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

代码示例来源:origin: org.opencb.cellbase/cellbase-lib

String aaShortName = null;
if (query.get("position") != null && !query.getString("position").isEmpty() && query.getInt("position", 0) != 0) {
  position = query.getInt("position");
  String projectionString = "aaPositions." + position;

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

try {
  filterList.putAll(parseAnnotationQueryField(query.getString(Constants.ANNOTATION),
      query.get(Constants.PRIVATE_ANNOTATION_PARAM_TYPES, ObjectMap.class), variableSetList));
} catch (CatalogException e) {
  logger.warn("Error parsing annotation info: {}", e.getMessage(), e);

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

String aaShortName = null;
if (query.get("position") != null && !query.getString("position").isEmpty() && query.getInt("position", 0) != 0) {
  position = query.getInt("position");
  String projectionString = "aaPositions." + position;

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

@GET
@Path("/{chrRegionId}/repeat")
@ApiOperation(httpMethod = "GET", value = "Retrieves all repeats for the regions", response = Transcript.class,
    responseContainer = "QueryResponse")
public Response getRepeatByRegion(@PathParam("chrRegionId")
                   @ApiParam(name = "chrRegionId",
                       value = "comma-separated list of genomic regions to be queried, "
                           + "e.g. 1:11869-14412", required = true) String region) {
  try {
    parseQueryParams();
    RepeatsDBAdaptor repeatsDBAdaptor = dbAdaptorFactory.getRepeatsDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(region, RepeatsDBAdaptor.QueryParams.REGION.key());
    List<QueryResult> queryResults = repeatsDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResults.get(i).setId((String) queries.get(i).get(RepeatsDBAdaptor.QueryParams.REGION.key()));
    }
    return createOkResponse(queryResults);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

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

if (isValidParam(query, VariantQueryParam.STUDY)) {
  studies = VariantQueryUtils.getIncludeStudiesList(
      new Query(VariantQueryParam.STUDY.key(), query.get(VariantQueryParam.STUDY.key())),
      Collections.singleton(VariantField.STUDIES));
} else {

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

@GET
@Path("/{tfId}/tfbs")
@ApiOperation(httpMethod = "GET", value = "Retrieves the corresponding TFBS objects",
    response = RegulatoryFeature.class, responseContainer = "QueryResponse")
@ApiImplicitParams({
    @ApiImplicitParam(name = "region",
        value = "Comma separated list of genomic regions to be queried, e.g.: 1:6635137-6635325",
        required = false, dataType = "java.util.List", paramType = "query")
})
public Response getAllByTfbs(@PathParam("tfId")
                     @ApiParam(name = "tfId", value = "String containing a comma separated list "
                         + " of TF names to search, e.g.: CTCF", required = true) String tfId,
               @DefaultValue("") @QueryParam("celltype") String celltype) {
  try {
    parseQueryParams();
    RegulationDBAdaptor regulationDBAdaptor = dbAdaptorFactory.getRegulationDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(tfId, RegulationDBAdaptor.QueryParams.NAME.key(),
        RegulationDBAdaptor.QueryParams.FEATURE_TYPE.key(), RegulationDBAdaptor.FeatureType.TF_binding_site
            + "," + RegulationDBAdaptor.FeatureType.TF_binding_site_motif);
    List<QueryResult> queryResults = regulationDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResults.get(i).setId((String) queries.get(i).get(RegulationDBAdaptor.QueryParams.NAME.key()));
    }
    return createOkResponse(queryResults);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

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

@GET
@Path("/{proteinId}/info")
@ApiOperation(httpMethod = "GET", value = "Get the protein info", response = Entry.class,
    responseContainer = "QueryResponse")
@ApiImplicitParams({
    @ApiImplicitParam(name = "keyword",
        value = "Comma separated list of keywords that may be associated with the protein(s), e.g.: "
            + "Transcription,Zinc. Exact text matches will be returned",
        required = false, dataType = "java.util.List", paramType = "query")
})
public Response getInfoByEnsemblId(@PathParam("proteinId")
                  @ApiParam(name = "proteinId",
                      value = "Comma separated list of xrefs ids, e.g.: CCDS31418.1,Q9UL59,"
                          + " ENST00000278314. Exact text matches will be returned",
                      required = true) String id) {
  try {
    parseQueryParams();
    ProteinDBAdaptor proteinDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(id, ProteinDBAdaptor.QueryParams.XREFS.key());
    List<QueryResult> queryResults = proteinDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResults.get(i).setId((String) queries.get(i).get(ProteinDBAdaptor.QueryParams.XREFS.key()));
    }
    return createOkResponse(queryResults);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

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

@GET
@Path("/{transcriptId}/protein")
@ApiOperation(httpMethod = "GET", value = "Get the protein info for the given transcript(s)", response = Entry.class,
    responseContainer = "QueryResponse")
@ApiImplicitParams({
    @ApiImplicitParam(name = "keyword",
        value = "Comma separated list of keywords that may be associated with the protein(s), e.g.: "
            + "Transcription,Zinc. Exact text matches will be returned",
        required = false, dataType = "java.util.List", paramType = "query")
})
public Response getProtein(@PathParam("transcriptId")
                @ApiParam(name = "transcriptId",
                value = "Comma-separated string with ENSEMBL transcript ids  e.g.: "
                    + "ENST00000536068,ENST00000544455. Exact text matches will be returned",
                required = true) String transcriptId) {
  try {
    parseQueryParams();
    ProteinDBAdaptor proteinDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(transcriptId, ProteinDBAdaptor.QueryParams.XREFS.key());
    List<QueryResult> queryResultList = proteinDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResultList.get(i).setId((String) queries.get(i).get(ProteinDBAdaptor.QueryParams.XREFS.key()));
    }
    return createOkResponse(queryResultList);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

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

public static boolean isSupportedQueryParam(Query query, QueryParam param) {
  return isSupportedQuery(new Query(param.key(), query.get(param.key())));
}

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

@GET
@Path("/{geneId}/protein")
@ApiOperation(httpMethod = "GET", value = "Return info of the corresponding proteins", response = Entry.class,
    responseContainer = "QueryResponse")
@ApiImplicitParams({
    @ApiImplicitParam(name = "keyword",
        value = "Comma separated list of keywords that may be associated with the protein(s), e.g.: "
            + "Transcription,Zinc. Exact text matches will be returned",
        required = false, dataType = "java.util.List", paramType = "query")
})
public Response getProteinById(@PathParam("geneId")
                @ApiParam(name = "geneId",
                    value = "Comma separated list of gene ids, e.g.: ENSG00000268020,BRCA2"
                        + "Exact text matches will be returned",
                    required = true) String geneId) {
  try {
    parseQueryParams();
    ProteinDBAdaptor proteinDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
    List<Query> queries = createQueries(geneId, ProteinDBAdaptor.QueryParams.XREFS.key());
    List<QueryResult> queryResults = proteinDBAdaptor.nativeGet(queries, queryOptions);
    for (int i = 0; i < queries.size(); i++) {
      queryResults.get(i).setId((String) queries.get(i).get(ProteinDBAdaptor.QueryParams.XREFS.key()));
    }
    return createOkResponse(queryResults);
  } catch (Exception e) {
    return createErrorResponse(e);
  }
}

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

List<QueryResult> queryResults = transcriptDBAdaptor.nativeGet(queries, queryOptions);
for (int i = 0; i < queries.size(); i++) {
  queryResults.get(i).setId((String) queries.get(i).get(TranscriptDBAdaptor.QueryParams.XREFS.key()));

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

queryResults.get(i).setId((String) queries.get(i).get(RegulationDBAdaptor.QueryParams.REGION.key()));

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

List<QueryResult> queryResults = transcriptDBAdaptor.nativeGet(queries, queryOptions);
for (int i = 0; i < queries.size(); i++) {
  queryResults.get(i).setId((String) queries.get(i).get(TranscriptDBAdaptor.QueryParams.REGION.key()));

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

List<QueryResult> queryResults = variationDBAdaptor.nativeGet(queries, queryOptions);
for (int i = 0; i < queries.size(); i++) {
  queryResults.get(i).setId((String) queries.get(i).get(VariantDBAdaptor.QueryParams.ID.key()));

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

List<QueryResult> queryResults = geneDBAdaptor.nativeGet(queries, queryOptions);
for (int i = 0; i < queries.size(); i++) {
  queryResults.get(i).setId((String) queries.get(i).get(GeneDBAdaptor.QueryParams.NAME.key()));

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

getHistogramIntervalSize(), queryOptions);
for (int i = 0; i < queries.size(); i++) {
  queryResults.get(i).setId((String) query.get(GeneDBAdaptor.QueryParams.REGION.key()));
  queryResults.get(i).setId((String) queries.get(i).get(RegulationDBAdaptor.QueryParams.REGION.key()));

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

public static Query getEngineQuery(Query query, QueryOptions options, StudyConfigurationManager scm) throws StorageEngineException {
  Collection<VariantQueryParam> uncoveredParams = uncoveredParams(query);
  Query engineQuery = new Query();
  for (VariantQueryParam uncoveredParam : uncoveredParams) {
    engineQuery.put(uncoveredParam.key(), query.get(uncoveredParam.key()));
  }
  // Despite STUDIES is a covered filter, it has to be in the underlying
  // query to be used as defaultStudy
  if (isValidParam(query, STUDY)) {
    if (!uncoveredParams.isEmpty()) {
      // This will set the default study, if needed
      engineQuery.put(STUDY.key(), query.get(STUDY.key()));
    } else if (!isValidParam(query, INCLUDE_STUDY)) {
      // If returned studies is not defined, we need to define it with the values from STUDIES
      List<Integer> studies = VariantQueryUtils.getIncludeStudies(query, options, scm);
      engineQuery.put(INCLUDE_STUDY.key(), studies);
    }
  }
  return engineQuery;
}

代码示例来源:origin: org.opencb.cellbase/cellbase-lib

@Override
public QueryResult nativeGet(Query query, QueryOptions options) {
  Bson bson = parseQuery(query);
  Bson match = Aggregates.match(bson);
  Bson project = Aggregates.project(Projections.include("transcripts.xrefs"));
  Bson unwind = Aggregates.unwind("$transcripts");
  Bson unwind2 = Aggregates.unwind("$transcripts.xrefs");
  // This project the three fields of Xref to the top of the object
  Document document = new Document("id", "$transcripts.xrefs.id");
  document.put("dbName", "$transcripts.xrefs.dbName");
  document.put("dbDisplayName", "$transcripts.xrefs.dbDisplayName");
  Bson project1 = Aggregates.project(document);
  if (query.containsKey(QueryParams.DBNAME.key())) {
    Bson bson2 = parseQuery(new Query(QueryParams.DBNAME.key(), query.get(QueryParams.DBNAME.key())));
    Bson match2 = Aggregates.match(bson2);
    return mongoDBCollection.aggregate(Arrays.asList(match, project, unwind, unwind2, match2, project1), options);
  }
  return mongoDBCollection.aggregate(Arrays.asList(match, project, unwind, unwind2, project1), options);
}

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

@Override
public QueryResult nativeGet(Query query, QueryOptions options) {
  Bson bson = parseQuery(query);
  Bson match = Aggregates.match(bson);
  Bson project = Aggregates.project(Projections.include("transcripts.xrefs"));
  Bson unwind = Aggregates.unwind("$transcripts");
  Bson unwind2 = Aggregates.unwind("$transcripts.xrefs");
  // This project the three fields of Xref to the top of the object
  Document document = new Document("id", "$transcripts.xrefs.id");
  document.put("dbName", "$transcripts.xrefs.dbName");
  document.put("dbDisplayName", "$transcripts.xrefs.dbDisplayName");
  Bson project1 = Aggregates.project(document);
  if (query.containsKey(QueryParams.DBNAME.key())) {
    Bson bson2 = parseQuery(new Query(QueryParams.DBNAME.key(), query.get(QueryParams.DBNAME.key())));
    Bson match2 = Aggregates.match(bson2);
    return mongoDBCollection.aggregate(Arrays.asList(match, project, unwind, unwind2, match2, project1), options);
  }
  return mongoDBCollection.aggregate(Arrays.asList(match, project, unwind, unwind2, project1), options);
}

相关文章