本文整理了Java中org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils.isNegated()
方法的一些代码示例,展示了VariantQueryUtils.isNegated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VariantQueryUtils.isNegated()
方法的具体详情如下:
包路径:org.opencb.opencga.storage.core.variant.adaptors.VariantQueryUtils
类名称:VariantQueryUtils
方法名:isNegated
[英]Determines if the filter is negated.
[中]确定过滤器是否为反。
代码示例来源:origin: opencb/opencga
protected List<String> getValuesToValidate(List<String> rawValues) {
return rawValues.stream()
.map(value -> {
value = isNegated(value) ? removeNegation(value) : value;
String[] strings = VariantQueryUtils.splitOperator(value);
boolean withComparisionOperator = strings[0] != null;
if (withComparisionOperator) {
value = strings[0];
}
return value;
})
.collect(Collectors.toList());
}
代码示例来源:origin: opencb/opencga
private DBObject[] getFileFilterDBObjects(String key, List<String> filterValues) {
DBObject[] regexList = new DBObject[filterValues.size()];
for (int i = 0; i < filterValues.size(); i++) {
String filter = filterValues.get(i);
boolean negated = isNegated(filter);
if (negated) {
filter = removeNegation(filter);
}
if (filter.contains(VCFConstants.FILTER_CODE_SEPARATOR) || filter.equals(VCFConstants.PASSES_FILTERS_v4)) {
if (!negated) {
regexList[i] = new BasicDBObject(key, filter);
} else {
regexList[i] = new BasicDBObject(key, new BasicDBObject("$ne", filter));
}
} else {
if (!negated) {
regexList[i] = new BasicDBObject(key, new BasicDBObject("$regex", filter));
} else {
regexList[i] = new BasicDBObject(key, new BasicDBObject("$not", Pattern.compile(filter)));
}
}
}
return regexList;
}
代码示例来源:origin: opencb/opencga
public Integer getStudyId(Object studyObj, boolean skipNegated, Map<String, Integer> studies) {
Integer studyId;
if (studyObj instanceof Integer) {
studyId = ((Integer) studyObj);
} else {
String studyName = studyObj.toString();
if (isNegated(studyName)) { //Skip negated studies
if (skipNegated) {
return null;
} else {
studyName = removeNegation(studyName);
}
}
if (StringUtils.isNumeric(studyName)) {
studyId = Integer.parseInt(studyName);
} else {
Integer value = studies.get(studyName);
if (value == null) {
throw VariantQueryException.studyNotFound(studyName, studies.keySet());
}
studyId = value;
}
}
if (!studies.containsValue(studyId)) {
throw VariantQueryException.studyNotFound(studyId, studies.keySet());
}
return studyId;
}
代码示例来源:origin: opencb/opencga
/**
* Parse the genotype filter.
*
* @param sampleGenotypes Genotypes filter value
* @param map Initialized map to be filled with the sample to list of genotypes
* @return QueryOperation between samples
*/
public static QueryOperation parseGenotypeFilter(String sampleGenotypes, Map<Object, List<String>> map) {
Pair<QueryOperation, Map<String, String>> pair = parseMultiKeyValueFilter(GENOTYPE, sampleGenotypes);
for (Map.Entry<String, String> entry : pair.getValue().entrySet()) {
List<String> gts = splitValue(entry.getValue(), QueryOperation.OR);
boolean anyNegated = false;
boolean allNegated = true;
for (String gt : gts) {
if (isNegated(gt)) {
anyNegated = true;
} else {
allNegated = false;
}
}
if (!allNegated && anyNegated) {
throw VariantQueryException.malformedParam(GENOTYPE, sampleGenotypes);
}
map.put(entry.getKey(), gts);
}
return pair.getKey();
}
代码示例来源: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
if (isNegated(str)) {
str = removeNegation(str);
代码示例来源:origin: opencb/opencga
public static boolean isOutputMultiStudy(Query query, QueryOptions options, Collection<?> studies) {
Set<VariantField> fields = VariantField.getIncludeFields(options);
if (!fields.contains(VariantField.STUDIES)) {
return false;
} else if (isValidParam(query, INCLUDE_STUDY)) {
String includeStudy = query.getString(VariantQueryParam.INCLUDE_STUDY.key());
if (NONE.equals(includeStudy)) {
return false;
} else if (ALL.equals(includeStudy)) {
return studies.size() > 1;
} else {
return query.getAsList(VariantQueryParam.INCLUDE_STUDY.key()).size() > 1;
}
} else if (isValidParam(query, STUDY)) {
String value = query.getString(VariantQueryParam.STUDY.key());
long numStudies = splitValue(value, checkOperator(value)).stream().filter(s -> !isNegated(s)).count();
return numStudies > 1;
} else {
return studies.size() > 1;
}
}
代码示例来源:origin: opencb/opencga
samples = splitValue(value, checkOperator(value))
.stream()
.filter((v) -> !isNegated(v)) // Discard negated
.collect(Collectors.toList());
代码示例来源:origin: opencb/opencga
includeFiles = splitValue(files, checkOperator(files))
.stream()
.filter(value -> !isNegated(value))
.collect(Collectors.toList());
代码示例来源:origin: opencb/opencga
if (elem instanceof String && isNegated((String) elem)) {
T mapped = map.apply((S) removeNegation((String) elem));
if (mapped instanceof Collection) {
List<Object> list = new ArrayList<>(values.size());
for (S elem : values) {
if (elem instanceof String && isNegated((String) elem)) {
throw new VariantQueryException("Unable to use negate (!) operator in OR sequences (<it_1>(,<it_n>)*)");
} else {
if (elem instanceof String && isNegated((String) elem)) {
T mapped = map.apply((S) removeNegation((String) elem));
if (mapped instanceof Collection) {
代码示例来源:origin: opencb/opencga
valid &= !isNegated(gt);
代码示例来源:origin: opencb/opencga
valid &= !isNegated(gt);
queryOperation = VariantQueryUtils.checkOperator(samplesStr);
List<String> samples = VariantQueryUtils.splitValue(samplesStr, queryOperation);
samples.stream().filter(s -> !isNegated(s)).forEach(sample -> samplesMap.put(sample, Collections.emptyList()));
代码示例来源:origin: opencb/opencga
String study = iterator.next();
Integer studyId = studyConfigurationManager.getStudyId(study, false, studies);
if (isNegated(study)) {
sb.append("\"").append(getStudyColumn(studyId).column()).append("\" IS NULL ");
} else {
if (isNegated(file)) {
for (int i = 0; i < filterValues.size(); i++) {
String filter = checkStringValue(filterValues.get(i));
boolean negated = isNegated(filter);
if (negated) {
filter = removeNegation(filter);
for (String cohort : query.getAsStringList(COHORT.key())) {
boolean negated = false;
if (isNegated(cohort)) {
cohort = removeNegation(cohort);
negated = true;
代码示例来源:origin: opencb/opencga
} else {
String sampleStr = sampleObj.toString();
if (isNegated(sampleStr)) {
sampleStr = removeNegation(sampleStr);
代码示例来源:origin: opencb/opencga
} else {
sampleIds = samples.stream()
.map(sample -> isNegated(sample) ? removeNegation(sample) : sample)
.map(sample -> studyConfigurationManager.getSampleId(sample, studyConfiguration)).collect(Collectors.toList());
file = isNegated(file) ? removeNegation(file) : file;
Integer fileId = StudyConfigurationManager.getFileIdFromStudy(file, studyConfiguration);
if (fileId == null) {
代码示例来源:origin: opencb/opencga
.filter(value -> !isNegated(value))
.map(value -> {
Integer fileId = studyConfigurationManager.getFileIdPair(value, false, defaultStudyConfiguration).getValue();
if (isNegated(sample)) {
throw VariantQueryException.malformedParam(SAMPLE, samples, "Unsupported negated samples");
for (String genotype : genotypes) {
if (isNegated(genotype)) {
if (defaultGenotypes.contains(removeNegation(genotype))) {
canFilterSampleByFile = true;
boolean negated = isNegated(genotype);
if (negated) {
genotype = removeNegation(genotype);
代码示例来源:origin: opencb/opencga
if (isNegated(fileStr)) { //Skip negated studies
if (skipNegated) {
return null;
代码示例来源:origin: opencb/opencga
@Override
public Query preProcessQuery(Query originalQuery, QueryOptions options) throws StorageEngineException {
Query query = super.preProcessQuery(originalQuery, options);
List<String> studyNames = studyConfigurationManager.getStudyNames(QueryOptions.empty());
CellBaseUtils cellBaseUtils = getCellBaseUtils();
if (isValidParam(query, VariantQueryParam.STUDY)
&& studyNames.size() == 1
&& !isNegated(query.getString(VariantQueryParam.STUDY.key()))
&& !isValidParam(query, FILE)
&& !isValidParam(query, FILTER)
&& !isValidParam(query, QUAL)
&& !isValidParam(query, INFO)
&& !isValidParam(query, SAMPLE)
&& !isValidParam(query, FORMAT)
&& !isValidParam(query, GENOTYPE)) {
query.remove(VariantQueryParam.STUDY.key());
}
convertGoToGeneQuery(query, cellBaseUtils);
convertExpressionToGeneQuery(query, cellBaseUtils);
return query;
}
代码示例来源:origin: opencb/opencga
Pair<Integer, Integer> fileIdPair = studyConfigurationManager.getFileIdPair(file, false, defaultStudyConfiguration);
byte[] column = buildFileColumnKey(fileIdPair.getKey(), fileIdPair.getValue());
if (isNegated(file)) {
subFilters.addFilter(missingColumnFilter(column));
} else {
Integer studyId = studyConfigurationManager.getStudyId(studyStr, null);
byte[] column = VariantPhoenixHelper.getStudyColumn(studyId).bytes();
if (isNegated(studyStr)) {
subFilters.addFilter(missingColumnFilter(column));
scan.addColumn(family, column);
内容来源于网络,如有侵权,请联系作者删除!