List of usage examples for com.mongodb QueryBuilder start
public static QueryBuilder start(final String key)
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllByIdList(List<String> idList, QueryOptions options) { List<DBObject> queries = new ArrayList<>(); for (String id : idList) { QueryBuilder builder = QueryBuilder.start("id").is(id); queries.add(builder.get());// w w w . j a v a2 s.co m } return executeQueryList2(idList, queries, options); }
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public QueryResult getAllByPhenotype(String phenotype, QueryOptions options) { QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype); return executeQuery(phenotype, builder.get(), options); }
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public QueryResult getAllByGene(String gene, QueryOptions options) { QueryBuilder builder = QueryBuilder.start("associatedGenes").is(gene); return executeQuery(gene, builder.get(), options); }
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllByGeneList(List<String> geneList, QueryOptions options) { List<DBObject> queries = new ArrayList<>(geneList.size()); for (String id : geneList) { QueryBuilder builder = QueryBuilder.start("associatedGenes").is(id); queries.add(builder.get());//from w w w.j a va2s . co m } return executeQueryList2(geneList, queries, options); }
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public QueryResult getAllGenesByPhenotype(String phenotype, QueryOptions options) { QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype); return executeQuery(phenotype, builder.get(), options); }
From source file:org.opencb.cellbase.mongodb.db.variation.VariationPhenotypeAnnotationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllGenesByPhenotypeList(List<String> phenotypeList, QueryOptions options) { List<DBObject> queries = new ArrayList<>(phenotypeList.size()); for (String id : phenotypeList) { QueryBuilder builder = QueryBuilder.start("phenotype").is(id); queries.add(builder.get());/*w ww . j av a2s . co m*/ } return executeQueryList2(phenotypeList, queries, options); }
From source file:org.opencb.cellbase.mongodb.db.VariationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllByIdList(List<String> idList, QueryOptions options) { List<DBObject> queries = new ArrayList<>(); for (String id : idList) { QueryBuilder builder = QueryBuilder.start("id").is(id); queries.add(builder.get());//from w ww. j a v a 2 s. c om } return executeQueryList(idList, queries, options); }
From source file:org.opencb.cellbase.mongodb.db.VariationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllByTranscriptIdList(List<String> idList, QueryOptions options) { List<DBObject> queries = new ArrayList<>(); for (String id : idList) { QueryBuilder builder = QueryBuilder.start("transcriptVariations.transcriptId").is(id); queries.add(builder.get());//from ww w. j a va 2s. com } return executeQueryList(idList, queries, options); }
From source file:org.opencb.cellbase.mongodb.db.VariationMongoDBAdaptor.java
License:Apache License
@Override public QueryResult getAllPhenotypes(QueryOptions options) { // return executeDistinct("distinct", "phenotype", mongoVariationPhenotypeDBCollection); QueryBuilder builder = new QueryBuilder(); if (options.containsKey("phenotype")) { String pheno = options.getString("phenotype"); if (pheno != null && !pheno.equals("")) { builder = builder.start("phenotype").is(pheno); }/*w ww. j a va 2 s . c om*/ } return executeQuery("result", builder.get(), options, mongoVariationPhenotypeDBCollection); }
From source file:org.opencb.cellbase.mongodb.db.VariationMongoDBAdaptor.java
License:Apache License
@Override public List<QueryResult> getAllPhenotypeByRegion(List<Region> regions, QueryOptions options) { QueryBuilder builder = null;//from ww w . ja v a2s . c o m List<DBObject> queries = new ArrayList<>(); /** * If source is present in options is it parsed and prepare first, * otherwise ti will be done for each iteration of regions. */ List<Object> source = options.getList("source", null); BasicDBList sourceIds = new BasicDBList(); if (source != null && source.size() > 0) { sourceIds.addAll(source); } // List<Region> regions = Region.parseRegions(options.getString("region")); List<String> ids = new ArrayList<>(regions.size()); for (Region region : regions) { if (region != null && !region.equals("")) { // If regions is 1 position then query can be optimize using chunks if (region.getStart() == region.getEnd()) { String chunkId = getChunkIdPrefix(region.getChromosome(), region.getStart(), variationChunkSize); System.out.println(chunkId); builder = QueryBuilder.start("_chunkIds").is(chunkId).and("end") .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd()); } else { builder = QueryBuilder.start("chromosome").is(region.getChromosome()).and("end") .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd()); } if (sourceIds != null && sourceIds.size() > 0) { builder = builder.and("source").in(sourceIds); } queries.add(builder.get()); ids.add(region.toString()); } } return executeQueryList(ids, queries, options, db.getCollection("variation_phenotype_annotation")); }