List of usage examples for com.mongodb.client.model Filters and
public static Bson and(final Bson... filters)
From source file:org.opencb.cellbase.lib.impl.ConservationMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, ConservationDBAdaptor.QueryParams.REGION.key(), andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else {//from www. j a v a2 s.co m return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.GeneMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, QueryParams.REGION.key(), MongoDBCollectionConfiguration.GENE_CHUNK_SIZE, andBsonList);/* w w w . j av a2s . c o m*/ createOrQuery(query, QueryParams.ID.key(), "id", andBsonList); createOrQuery(query, QueryParams.NAME.key(), "name", andBsonList); createOrQuery(query, QueryParams.BIOTYPE.key(), "biotype", andBsonList); createOrQuery(query, QueryParams.XREFS.key(), "transcripts.xrefs.id", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_ID.key(), "transcripts.id", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_NAME.key(), "transcripts.name", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_BIOTYPE.key(), "transcripts.biotype", andBsonList); createOrQuery(query, QueryParams.TFBS_NAME.key(), "transcripts.tfbs.name", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DISEASE_ID.key(), "annotation.diseases.id", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DISEASE_NAME.key(), "annotation.diseases.name", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_EXPRESSION_GENE.key(), "annotation.expression.geneName", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_EXPRESSION_TISSUE.key(), "annotation.expression.factorValue", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DRUGS_NAME.key(), "annotation.drugs.drugName", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DRUGS_GENE.key(), "annotation.drugs.geneName", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else { return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.GenomeMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, GenomeDBAdaptor.QueryParams.REGION.key(), MongoDBCollectionConfiguration.GENOME_SEQUENCE_CHUNK_SIZE, andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else {//ww w. j av a 2 s .c o m return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.ProteinMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createOrQuery(query, QueryParams.ACCESSION.key(), "accession", andBsonList); createOrQuery(query, QueryParams.NAME.key(), "name", andBsonList); createOrQuery(query, QueryParams.GENE.key(), "gene.name.value", andBsonList); createOrQuery(query, QueryParams.XREFS.key(), "dbReference.id", andBsonList); createOrQuery(query, QueryParams.KEYWORD.key(), "keyword.value", andBsonList); createOrQuery(query, QueryParams.FEATURE_ID.key(), "feature.id", andBsonList); createOrQuery(query, QueryParams.FEATURE_TYPE.key(), "feature.type", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else {//w w w . j av a2 s . c o m return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.ProteinProteinInteractionMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.INTERACTOR_A_ID.key(), "interactorA.id", andBsonList);/*from w w w . ja v a2 s . com*/ createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.INTERACTOR_B_ID.key(), "interactorB.id", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.INTERACTOR_A_XREFS.key(), "interactorA.xrefs", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.INTERACTOR_B_XREFS.key(), "interactorB.xrefs", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.XREFs.key(), "xrefs.id", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.TYPE_PSIMI.key(), "type.name", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.TYPE_NAME.key(), "type.name", andBsonList); createOrQuery(query, ProteinProteinInteractionDBAdaptor.QueryParams.DETECTION_METHOD_NAME.key(), "detectionMethod.name", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else { return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.RegulationMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, QueryParams.REGION.key(), MongoDBCollectionConfiguration.REGULATORY_REGION_CHUNK_SIZE, andBsonList); createOrQuery(query, QueryParams.NAME.key(), "name", andBsonList); createOrQuery(query, QueryParams.FEATURE_TYPE.key(), "featureType", andBsonList); createOrQuery(query, QueryParams.FEATURE_CLASS.key(), "featureClass", andBsonList); createOrQuery(query, QueryParams.CELL_TYPES.key(), "cellTypes", andBsonList); createOrQuery(query, QueryParams.SCORE.key(), "score", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else {// w w w. j a va 2 s . co m return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.VariantMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, VariantMongoDBAdaptor.QueryParams.REGION.key(), MongoDBCollectionConfiguration.VARIATION_CHUNK_SIZE, andBsonList); createOrQuery(query, VariantMongoDBAdaptor.QueryParams.ID.key(), "id", andBsonList); createOrQuery(query, QueryParams.CHROMOSOME.key(), "chromosome", andBsonList); createImprecisePositionQuery(query, QueryParams.CI_START_LEFT.key(), QueryParams.CI_START_RIGHT.key(), "sv.ciStartLeft", "sv.ciStartRight", andBsonList); createImprecisePositionQuery(query, QueryParams.CI_END_LEFT.key(), QueryParams.CI_END_RIGHT.key(), "sv.ciEndLeft", "sv.ciEndRight", andBsonList); createOrQuery(query, QueryParams.START.key(), "start", andBsonList, QueryValueType.INTEGER); // createOrQuery(query, QueryParams.REFERENCE.key(), "reference", andBsonList); if (query.containsKey(QueryParams.REFERENCE.key())) { createOrQuery(query.getAsStringList(QueryParams.REFERENCE.key()), "reference", andBsonList); }/* ww w .j ava 2s. c o m*/ if (query.containsKey(QueryParams.ALTERNATE.key())) { createOrQuery(query.getAsStringList(QueryParams.ALTERNATE.key()), "alternate", andBsonList); } // createOrQuery(query, QueryParams.ALTERNATE.key(), "alternate", andBsonList); createOrQuery(query, VariantMongoDBAdaptor.QueryParams.CONSEQUENCE_TYPE.key(), "annotation.consequenceTypes.sequenceOntologyTerms.name", andBsonList); // createOrQuery(query, VariantMongoDBAdaptor.QueryParams.GENE.key(), "annotation.consequenceTypes.ensemblGeneId", // andBsonList); createGeneOrQuery(query, VariantMongoDBAdaptor.QueryParams.GENE.key(), andBsonList); // createOrQuery(query, VariantMongoDBAdaptor.QueryParams.XREFS.key(), "transcripts.xrefs.id", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else { return new Document(); } }
From source file:org.opencb.cellbase.lib.impl.XRefMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createOrQuery(query, XRefDBAdaptor.QueryParams.ID.key(), "transcripts.xrefs.id", andBsonList); createOrQuery(query, XRefDBAdaptor.QueryParams.DBNAME.key(), "transcripts.xrefs.dbName", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else {//from w w w.ja v a 2 s. c o m return new Document(); } }
From source file:org.opencb.cellbase.mongodb.impl.ClinicalMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { logger.info("Parsing query..."); Bson filtersBson = null;/* w ww. jav a 2 s. c o m*/ // No filtering parameters mean all records if (query.size() > 0) { Bson commonFiltersBson = getCommonFilters(query); Set<String> sourceContent = query.getAsStringList(QueryParams.SOURCE.key()) != null ? new HashSet<>(query.getAsStringList(QueryParams.SOURCE.key())) : null; List<Bson> sourceSpecificFilterList = new ArrayList<>(); getClinvarFilters(query, sourceContent, sourceSpecificFilterList); getCosmicFilters(query, sourceContent, sourceSpecificFilterList); getGwasFilters(query, sourceContent, sourceSpecificFilterList); if (sourceSpecificFilterList.size() > 0 && commonFiltersBson != null) { List<Bson> filtersBsonList = new ArrayList<>(); filtersBsonList.add(commonFiltersBson); filtersBsonList.add(Filters.or(sourceSpecificFilterList)); filtersBson = Filters.and(filtersBsonList); } else if (commonFiltersBson != null) { filtersBson = commonFiltersBson; } else if (sourceSpecificFilterList.size() > 0) { filtersBson = Filters.or(sourceSpecificFilterList); } } if (filtersBson != null) { return filtersBson; } else { return new Document(); } }
From source file:org.opencb.cellbase.mongodb.impl.GeneMongoDBAdaptor.java
License:Apache License
private Bson parseQuery(Query query) { List<Bson> andBsonList = new ArrayList<>(); createRegionQuery(query, QueryParams.REGION.key(), MongoDBCollectionConfiguration.GENE_CHUNK_SIZE, andBsonList);/*from w w w .j a v a 2s. co m*/ createOrQuery(query, QueryParams.ID.key(), "id", andBsonList); createOrQuery(query, QueryParams.NAME.key(), "name", andBsonList); createOrQuery(query, QueryParams.BIOTYPE.key(), "biotype", andBsonList); createOrQuery(query, QueryParams.XREFS.key(), "transcripts.xrefs.id", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_ID.key(), "transcripts.id", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_NAME.key(), "transcripts.name", andBsonList); createOrQuery(query, QueryParams.TRANSCRIPT_BIOTYPE.key(), "transcripts.biotype", andBsonList); createOrQuery(query, QueryParams.TFBS_NAME.key(), "transcripts.tfbs.name", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DISEASE_ID.key(), "annotation.diseases.id", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DISEASE_NAME.key(), "annotation.diseases.name", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_EXPRESSION_GENE.key(), "annotation.expression.gene", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_EXPRESSION_TISSUE.key(), "annotation.expression.tissue", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DRUGS_NAME.key(), "annotation.drugs.name", andBsonList); createOrQuery(query, QueryParams.ANNOTATION_DRUGS_GENE.key(), "annotation.drugs.gene", andBsonList); if (andBsonList.size() > 0) { return Filters.and(andBsonList); } else { return new Document(); } }