本文整理了Java中org.opencb.commons.datastore.core.Query.getAsStringList
方法的一些代码示例,展示了Query.getAsStringList
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getAsStringList
方法的具体详情如下:
包路径:org.opencb.commons.datastore.core.Query
类名称:Query
方法名:getAsStringList
暂无
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
public List<QueryResult> getPhenotypeGeneRelations(Query query, QueryOptions queryOptions) {
Set<String> sourceContent = query.getAsStringList(QueryParams.SOURCE.key()) != null
? new HashSet<>(query.getAsStringList(QueryParams.SOURCE.key())) : null;
List<QueryResult> queryResultList = new ArrayList<>();
if (sourceContent == null || sourceContent.contains("clinvar")) {
queryResultList.add(getClinvarPhenotypeGeneRelations(queryOptions));
}
if (sourceContent == null || sourceContent.contains("gwas")) {
queryResultList.add(getGwasPhenotypeGeneRelations(queryOptions));
}
return queryResultList;
}
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
public List<QueryResult> getPhenotypeGeneRelations(Query query, QueryOptions queryOptions) {
Set<String> sourceContent = query.getAsStringList(QueryParams.SOURCE.key()) != null
? new HashSet<>(query.getAsStringList(QueryParams.SOURCE.key())) : null;
List<QueryResult> queryResultList = new ArrayList<>();
if (sourceContent == null || sourceContent.contains("clinvar")) {
queryResultList.add(getClinvarPhenotypeGeneRelations(queryOptions));
}
if (sourceContent == null || sourceContent.contains("gwas")) {
queryResultList.add(getGwasPhenotypeGeneRelations(queryOptions));
}
return queryResultList;
}
代码示例来源:origin: opencb/cellbase
public List<QueryResult> getPhenotypeGeneRelations(Query query, QueryOptions queryOptions) {
Set<String> sourceContent = query.getAsStringList(QueryParams.SOURCE.key()) != null
? new HashSet<>(query.getAsStringList(QueryParams.SOURCE.key())) : null;
List<QueryResult> queryResultList = new ArrayList<>();
if (sourceContent == null || sourceContent.contains("clinvar")) {
queryResultList.add(getClinvarPhenotypeGeneRelations(queryOptions));
}
if (sourceContent == null || sourceContent.contains("gwas")) {
queryResultList.add(getGwasPhenotypeGeneRelations(queryOptions));
}
return queryResultList;
}
代码示例来源:origin: opencb/cellbase
public List<QueryResult> getPhenotypeGeneRelations(Query query, QueryOptions queryOptions) {
Set<String> sourceContent = query.getAsStringList(QueryParams.SOURCE.key()) != null
? new HashSet<>(query.getAsStringList(QueryParams.SOURCE.key())) : null;
List<QueryResult> queryResultList = new ArrayList<>();
if (sourceContent == null || sourceContent.contains("clinvar")) {
queryResultList.add(getClinvarPhenotypeGeneRelations(queryOptions));
}
if (sourceContent == null || sourceContent.contains("gwas")) {
queryResultList.add(getGwasPhenotypeGeneRelations(queryOptions));
}
return queryResultList;
}
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
private void createGeneOrQuery(Query query, String queryParam, List<Bson> andBsonList) {
if (query != null) {
List<String> geneList = query.getAsStringList(queryParam);
if (geneList != null && !geneList.isEmpty()) {
if (geneList.size() == 1) {
andBsonList.add(getGeneQuery(geneList.get(0)));
} else {
List<Bson> orBsonList = new ArrayList<>(geneList.size());
for (String geneId : geneList) {
orBsonList.add(getGeneQuery(geneId));
}
andBsonList.add(Filters.or(orBsonList));
}
}
}
}
代码示例来源:origin: opencb/cellbase
private void createGeneOrQuery(Query query, String queryParam, List<Bson> andBsonList) {
if (query != null) {
List<String> geneList = query.getAsStringList(queryParam);
if (geneList != null && !geneList.isEmpty()) {
if (geneList.size() == 1) {
andBsonList.add(getGeneQuery(geneList.get(0)));
} else {
List<Bson> orBsonList = new ArrayList<>(geneList.size());
for (String geneId : geneList) {
orBsonList.add(getGeneQuery(geneId));
}
andBsonList.add(Filters.or(orBsonList));
}
}
}
}
代码示例来源:origin: org.opencb.commons/commons-datastore-mongodb
public static Bson createAutoFilter(String mongoDbField, String queryParam, Query query, QueryParam.Type type)
throws NumberFormatException {
Bson filter = null;
if (query != null && query.containsKey(queryParam)) {
List<String> values = query.getAsStringList(queryParam);
LogicalOperator operator = LogicalOperator.OR;
if (values.size() == 1) {
operator = checkOperator(values.get(0));
}
filter = createAutoFilter(mongoDbField, queryParam, query, type, operator);
}
return filter;
}
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
private void createClinvarClinicalSignificanceQuery(Query query, List<Bson> andBsonList) {
if (query != null && query.getString(QueryParams.CLINVARCLINSIG.key()) != null
&& !query.getString(QueryParams.CLINVARCLINSIG.key()).isEmpty()) {
createOrQuery(query.getAsStringList(QueryParams.CLINVARCLINSIG.key()).stream()
.map((clinicalSignificanceString) -> clinicalSignificanceString.replace("_", " "))
.collect(Collectors.toList()),
"clinvarSet.referenceClinVarAssertion.clinicalSignificance.description", andBsonList);
}
}
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
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: 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: opencb/cellbase
private void createClinvarClinicalSignificanceQuery(Query query, List<Bson> andBsonList) {
if (query != null && query.getString(QueryParams.CLINVARCLINSIG.key()) != null
&& !query.getString(QueryParams.CLINVARCLINSIG.key()).isEmpty()) {
createOrQuery(query.getAsStringList(QueryParams.CLINVARCLINSIG.key()).stream()
.map((clinicalSignificanceString) -> clinicalSignificanceString.replace("_", " "))
.collect(Collectors.toList()),
"clinvarSet.referenceClinVarAssertion.clinicalSignificance.description", 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/cellbase
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: org.opencb.cellbase/cellbase-lib
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/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 void fixQueryObject(Study study, Query query, String sessionId) throws CatalogException {
if (query.containsKey("inputFiles")) {
MyResources<File> resource = catalogManager.getFileManager().getUids(query.getAsStringList("inputFiles"), study.getFqn(),
sessionId);
query.put(JobDBAdaptor.QueryParams.INPUT_UID.key(), resource.getResourceList().stream().map(File::getUid)
.collect(Collectors.toList()));
query.remove("inputFiles");
}
if (query.containsKey("outputFiles")) {
MyResources<File> resource = catalogManager.getFileManager().getUids(query.getAsStringList("outputFiles"), study.getFqn(),
sessionId);
query.put(JobDBAdaptor.QueryParams.OUTPUT_UID.key(), resource.getResourceList().stream().map(File::getUid)
.collect(Collectors.toList()));
query.remove("outputFiles");
}
}
代码示例来源: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
void fixQueryObject(Study study, Query query, String sessionId) throws CatalogException {
if (StringUtils.isNotEmpty(query.getString(FileDBAdaptor.QueryParams.ID.key()))) {
MyResources<File> uids = getUids(query.getAsStringList(FileDBAdaptor.QueryParams.ID.key()), study.getFqn(), sessionId);
query.remove(FileDBAdaptor.QueryParams.ID.key());
query.put(FileDBAdaptor.QueryParams.UID.key(), uids.getResourceList().stream().map(File::getUid).collect(Collectors.toList()));
}
// The samples introduced could be either ids or names. As so, we should use the smart resolutor to do this.
if (StringUtils.isNotEmpty(query.getString(FileDBAdaptor.QueryParams.SAMPLES.key()))) {
MyResources<Sample> resource = catalogManager.getSampleManager().getUids(
query.getAsStringList(FileDBAdaptor.QueryParams.SAMPLES.key()), study.getFqn(), sessionId);
query.put(FileDBAdaptor.QueryParams.SAMPLE_UIDS.key(), resource.getResourceList().stream().map(Sample::getUid)
.collect(Collectors.toList()));
query.remove(FileDBAdaptor.QueryParams.SAMPLES.key());
}
}
代码示例来源:origin: opencb/opencga
private void fixQueryObject(Study study, Query query, String sessionId) throws CatalogException {
if (query.containsKey(CohortDBAdaptor.QueryParams.SAMPLES.key())) {
// First look for the sample ids.
MyResources<Sample> samples = catalogManager.getSampleManager()
.getUids(query.getAsStringList(CohortDBAdaptor.QueryParams.SAMPLES.key()), study.getFqn(), sessionId);
query.remove(CohortDBAdaptor.QueryParams.SAMPLES.key());
query.append(CohortDBAdaptor.QueryParams.SAMPLE_UIDS.key(), samples.getResourceList().stream().map(Sample::getUid)
.collect(Collectors.toList()));
}
}
代码示例来源:origin: opencb/opencga
@Test
public void queryByFamily() throws Exception {
Query query = queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(FAMILY.key(), "f1"), sessionId);
assertEquals(Arrays.asList("sample1", "sample2", "sample3", "sample4"), query.getAsStringList(SAMPLE.key()));
assertFalse(VariantQueryUtils.isValidParam(query, GENOTYPE));
query = queryUtils.parseQuery(new Query(STUDY.key(), "s1").append(FAMILY.key(), "f1").append(MODE_OF_INHERITANCE.key(), "MONOALLELIC"), sessionId);
assertEquals("sample3:0/1,1/1;sample4:0/0;sample1:0/0;sample2:0/0", query.getString(GENOTYPE.key()));
assertFalse(VariantQueryUtils.isValidParam(query, SAMPLE));
}
内容来源于网络,如有侵权,请联系作者删除!