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

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

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

Query.getString介绍

暂无

代码示例

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

private void createPhenotypeQuery(Query query, List<Bson> andBsonList) {
  if (query != null && query.getString(QueryParams.TRAIT.key()) != null
      && !query.getString(QueryParams.TRAIT.key()).isEmpty()) {
    andBsonList.add(Filters.text(query.getString(QueryParams.TRAIT.key())));
  }
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString("region") != null) {
    Region region = Region.parseRegion(query.getString("region"));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString("region") != null) {
    Region region = Region.parseRegion(query.getString("region"));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

private void createClinvarTypeQuery(Query query, List<Bson> andBsonList) {
  if (query != null && query.getString(QueryParams.CLINVARTYPE.key()) != null
      && !query.getString(QueryParams.CLINVARTYPE.key()).isEmpty()) {
    createOrQuery(query.getAsStringList(QueryParams.CLINVARTYPE.key()).stream()
            .map((typeString) -> typeString.replace("_", " "))
            .collect(Collectors.toList()),
        "clinvarSet.referenceClinVarAssertion.measureSet.measure.type", andBsonList);
  }
}

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

private void createClinvarReviewQuery(Query query, List<Bson> andBsonList) {
  if (query != null && query.getString(QueryParams.CLINVARREVIEW.key()) != null
      && !query.getString(QueryParams.CLINVARREVIEW.key()).isEmpty()) {
    createOrQuery(query.getAsStringList(QueryParams.CLINVARREVIEW.key()).stream()
            .map(String::toUpperCase)
            .collect(Collectors.toList()),
        "clinvarSet.referenceClinVarAssertion.clinicalSignificance.reviewStatus", andBsonList);
  }
}

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

private Region parseRegion(Query query) {
  Region region = null;
  if (query != null) {
    String regionString = query.getString(QueryParams.REGION.key());
    if (StringUtils.isNotEmpty(regionString)) {
      region = new Region(regionString);
    }
  }
  return region;
}

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

protected void createOrQuery(Query query, String queryParam, String mongoDbField, List<Bson> andBsonList,
               QueryValueType queryValueType) {
  if (query != null && query.getString(queryParam) != null && !query.getString(queryParam).isEmpty()) {
    switch (queryValueType) {
      case INTEGER:
        createOrQuery(query.getAsIntegerList(queryParam), mongoDbField, andBsonList);
        break;
      default:
        createOrQuery(query.getAsStringList(queryParam), mongoDbField, andBsonList);
    }
  }
}

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

private List<String> getStudyIds(String userId, Query query) throws CatalogException {
  List<String> studyIds = new ArrayList<>();
  if (query != null && query.containsKey(ClinicalVariantEngine.QueryParams.STUDY.key())) {
    String study = query.getString(ClinicalVariantEngine.QueryParams.STUDY.key());
    List<String> studies = Arrays.asList(study.split(","));
    studyIds = catalogManager.getStudyManager().resolveIds(studies, userId)
        .stream()
        .map(Study::getFqn)
        .collect(Collectors.toList());
  }
  return studyIds;
}

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

private void createExpressionQuery(Query query, List<Bson> andBsonList) {
  if (query != null) {
    String tissue = query.getString(QueryParams.ANNOTATION_EXPRESSION_TISSUE.key());
    if (tissue != null && !tissue.isEmpty()) {
      String value = query.getString(QueryParams.ANNOTATION_EXPRESSION_VALUE.key());
      if (value != null && !value.isEmpty()) {
        andBsonList.add(Filters.elemMatch("annotation.expression",
            Filters.and(Filters.regex("factorValue", "(.)*" + tissue + "(.)*", "i"), Filters.eq("expression", value))));
      }
    }
  }
}

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

private List<Region> getRegions(Query query) {
  List<Region> regions = new ArrayList<>();
  if (isValidParam(query, REGION)) {
    regions.addAll(Region.parseRegions(query.getString(REGION.key())));
  }
  if (isValidParam(query, ANNOT_GENE_REGIONS)) {
    regions.addAll(Region.parseRegions(query.getString(ANNOT_GENE_REGIONS.key())));
  }
  regions = mergeRegions(regions);
  return regions;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

@Override
public QueryResult getIntervalFrequencies(Query query, int intervalSize, QueryOptions options) {
  if (query.getString(QueryParams.REGION.key()) != null) {
    Region region = Region.parseRegion(query.getString(QueryParams.REGION.key()));
    Bson bsonDocument = parseQuery(query);
    return getIntervalFrequencies(bsonDocument, region, intervalSize, options);
  }
  return null;
}

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

public static boolean isValidParam(Query query, QueryParam param, boolean discardNegated) {
  boolean validParam = isValidParam(query, param);
  if (!discardNegated || !validParam) {
    return validParam;
  } else {
    String strValue = query.getString(param.key());
    return splitValue(strValue, checkOperator(strValue))
        .stream()
        .anyMatch((v) -> !isNegated(v)); // Discard negated
  }
}

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

private boolean doHBaseColumnIntersect(Query query, QueryOptions options) {
  return options.getBoolean("hbase_column_intersect", true)
      // && !options.getBoolean(VariantHadoopDBAdaptor.NATIVE)
      && (isValidParam(query, SAMPLE) && isSupportedQueryParam(query, SAMPLE)
      || isValidParam(query, FILE) && isSupportedQueryParam(query, FILE)
      || isValidParam(query, GENOTYPE) && isSupportedQueryParam(query, GENOTYPE)
      && parseGenotypeFilter(query.getString(GENOTYPE.key()), new HashMap<>()) != QueryOperation.OR);
}

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

public Project getProjectFromQuery(Query query, String sessionId, QueryOptions options) throws CatalogException {
  if (isValidParam(query, VariantCatalogQueryUtils.PROJECT)) {
    String project = query.getString(VariantCatalogQueryUtils.PROJECT.key());
    return catalogManager.getProjectManager().get(project, options, sessionId).first();
  } else {
    String studyFqn = getAnyStudy(query, sessionId);
    String project = catalogManager.getStudyManager().getProjectFqn(studyFqn);
    return catalogManager.getProjectManager().get(new Query(ProjectDBAdaptor.QueryParams.FQN.key(), project), options, sessionId)
        .first();
  }
}

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

@Test
public void parseSampleAnnotationQuery() throws Exception {
  Query query = CatalogUtils.parseSampleAnnotationQuery("age>20;" + SampleDBAdaptor.QueryParams.PHENOTYPES.key() + "=hpo:123,hpo:456;" + SampleDBAdaptor.QueryParams.ID.key() + "=smith", SampleDBAdaptor.QueryParams::getParam);
  assertEquals(3, query.size());
  assertTrue(query.containsKey(SampleDBAdaptor.QueryParams.ID.key()));
  assertEquals("=smith", query.getString(SampleDBAdaptor.QueryParams.ID.key()));
  assertTrue(query.containsKey(SampleDBAdaptor.QueryParams.ANNOTATION.key()));
  assertEquals("annotation.age>20", query.getString(SampleDBAdaptor.QueryParams.ANNOTATION.key()));
  assertTrue(query.containsKey(SampleDBAdaptor.QueryParams.PHENOTYPES.key()));
  assertEquals("=hpo:123,hpo:456", query.getString(SampleDBAdaptor.QueryParams.PHENOTYPES.key()));
}

相关文章