本文整理了Java中org.opencb.commons.datastore.core.Query.put
方法的一些代码示例,展示了Query.put
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.put
方法的具体详情如下:
包路径:org.opencb.commons.datastore.core.Query
类名称:Query
方法名:put
暂无
代码示例来源:origin: opencb/cellbase
default Query createQuery(GenericServiceModel.Request request) {
Query query = new Query();
request.getQueryMap().keySet().stream()
.filter(key -> request.getQueryMap().get(key) != null)
.forEach(key -> {
query.put(key, request.getQueryMap().get(key));
});
return query;
}
代码示例来源:origin: opencb/opencga
protected Query createQuery(Request request) {
Query query = new Query();
for (String key : request.getQuery().keySet()) {
if (request.getQuery().get(key) != null) {
query.put(key, request.getQuery().get(key));
}
}
return query;
}
代码示例来源:origin: opencb/opencga
public VariantQueryResult<Variant> intersect(Query query, QueryOptions queryOptions, List<String> studyIds, String sessionId)
throws CatalogException, IOException, StorageEngineException {
Query intersectQuery = new Query(query);
intersectQuery.put(VariantQueryParam.STUDY.key(), String.join(VariantQueryUtils.AND, studyIds));
return get(intersectQuery, queryOptions, sessionId);
}
代码示例来源:origin: opencb/opencga
private void fixQueryObject(Study study, Query query, String sessionId) throws CatalogException {
// The individuals introduced could be either ids or names. As so, we should use the smart resolutor to do this.
if (StringUtils.isNotEmpty(query.getString(SampleDBAdaptor.QueryParams.INDIVIDUAL.key()))) {
MyResources<Individual> resource = catalogManager.getIndividualManager().getUids(
query.getAsStringList(SampleDBAdaptor.QueryParams.INDIVIDUAL.key()), study.getFqn(), sessionId);
query.put(SampleDBAdaptor.QueryParams.INDIVIDUAL_UID.key(), resource.getResourceList().stream().map(Individual::getUid)
.collect(Collectors.toList()));
query.remove(SampleDBAdaptor.QueryParams.INDIVIDUAL.key());
}
}
代码示例来源:origin: opencb/opencga
@Override
public QueryResult<Long> restore(Query query, QueryOptions queryOptions) throws CatalogDBException {
long startTime = startQuery();
query.put(QueryParams.STATUS_NAME.key(), Status.DELETED);
return endQuery("Restore projects", startTime, setStatus(query, Status.READY));
}
代码示例来源:origin: opencb/opencga
@Override
public QueryResult<Long> restore(Query query, QueryOptions queryOptions) throws CatalogDBException {
long startTime = startQuery();
query.put(QueryParams.STATUS_NAME.key(), Status.DELETED);
return endQuery("Restore studies", startTime, setStatus(query, Status.READY));
}
代码示例来源:origin: opencb/opencga
private QueryResult<File> getParents(boolean rootFirst, QueryOptions options, String filePath, long studyId) throws CatalogException {
List<String> paths = getParentPaths(filePath);
Query query = new Query(FileDBAdaptor.QueryParams.PATH.key(), paths);
query.put(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyId);
QueryResult<File> result = fileDBAdaptor.get(query, options);
result.getResult().sort(rootFirst ? ROOT_FIRST_COMPARATOR : ROOT_LAST_COMPARATOR);
return result;
}
代码示例来源: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 parseAnnot() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_CONSEQUENCE_TYPE.key(), "missense_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:\"NCF4_1583\"", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Override
public DBIterator<Job> iterator(String studyStr, Query query, QueryOptions options, String sessionId) throws CatalogException {
query = ParamUtils.defaultObject(query, Query::new);
options = ParamUtils.defaultObject(options, QueryOptions::new);
String userId = userManager.getUserId(sessionId);
Study study = catalogManager.getStudyManager().resolveId(studyStr, userId);
query.put(JobDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid());
fixQueryObject(study, query, sessionId);
return jobDBAdaptor.iterator(query, options, userId);
}
代码示例来源: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 parseNoExactSift() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_PROTEIN_SUBSTITUTION.key(), "sift!=-0.3");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=-sift:\\-0.3", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Test
public void parseHPOs() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_HPO.key(), "HP%3A000365,HP%3A0000007");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=(traits:\"HP%253A000365\"+OR+traits:\"HP%253A0000007\")", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Test
public void parseConsequenceTypeSOTerm() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_CONSEQUENCE_TYPE.key(), "missense_variant");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=soAcc:\"1583\"", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Test
public void parseExactSift() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_PROTEIN_SUBSTITUTION.key(), "sift==-0.3");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=sift:\\-0.3", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Test
public void parseExactSift2() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(ANNOT_PROTEIN_SUBSTITUTION.key(), "sift=-0.3");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=sift:\\-0.3", solrQuery.toString());
}
代码示例来源:origin: opencb/opencga
@Test
public void parseRegionChromosomeStartEnd() {
QueryOptions queryOptions = new QueryOptions();
Query query = new Query();
query.put(REGION.key(), "1:66381-76381,1:98766-117987");
SolrQuery solrQuery = solrQueryParser.parse(query, queryOptions);
display(query, queryOptions, solrQuery);
assertEquals(flDefault1 + "&q=*:*&fq=(chromosome:\"1\"+AND+start:[66381+TO+*]+AND+end:[*+TO+76381])+OR+(chromosome:\"1\"+AND+start:[98766+TO+*]+AND+end:[*+TO+117987])", solrQuery.toString());
}
内容来源于网络,如有侵权,请联系作者删除!