本文整理汇总了Java中com.healthmarketscience.sqlbuilder.ComboCondition.addCondition方法的典型用法代码示例。如果您正苦于以下问题:Java ComboCondition.addCondition方法的具体用法?Java ComboCondition.addCondition怎么用?Java ComboCondition.addCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.healthmarketscience.sqlbuilder.ComboCondition
的用法示例。
在下文中一共展示了ComboCondition.addCondition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCondition
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
/**
* Build the standard pharmacogenomic condition to be used when retrieving
* variants for any patient's analysis.
* @return the ComboCondition to be used for all analyses
* @deprecated This method creates a mega condition that retrieves all PGx
* variants from the DB. However, as the PGx DB grows, this condition
* will become unreasonably large, and is limited by the
* 'max_allowed_packet' property in MySQL. Replaced by {@link #buildConditionList()}
*/
@Deprecated
private static ComboCondition buildCondition() {
ComboCondition query= new ComboCondition(ComboCondition.Op.OR);
/* Get all relevant genes. */
List<String> genes= new LinkedList<String>();
try {
genes= PGXDBFunctions.getGenes();
} catch (SQLException se) {
se.printStackTrace();
}
/* Get all relevant markers. */
List<String> markers= new LinkedList<String>();
try {
for (String g : genes) {
markers.addAll(PGXDBFunctions.getMarkers(g));
}
} catch (Exception pe) {
pe.printStackTrace();
}
/* Add all markers to the ComboCondition.
* NOTE: this is hardcoded for now, but will need to be changed if the
* dbSNP annotation DB is updated. */
for (String m : markers) {
query.addCondition(
BinaryCondition.equalTo(ts.getDBColumn(columns.get(DBSNP_COLUMN)), m));
}
return query;
}
示例2: buildConditionList
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
/**
* Build the standard pharmacogenomic conditions to be used when retrieving
* variants for any patient's analysis and store these in a list.
* @return a Map of Conditions to be used for all PGx analyses
* @throws SQLException
*/
private static Map<String, Condition> buildConditionList() throws SQLException {
Map<String, Condition> queryMap= new HashMap<String, Condition>();
/* Get all relevant markers for a particular gene and create a
* ComboCondition for that set. Then add it to the List. */
for (String g : PGXDBFunctions.getGenes()) {
// generate a new query for this gene
ComboCondition query= new ComboCondition(ComboCondition.Op.OR);
try {
/* Add all the marker positions for this gene.
* NOTE: You can also search for variants using the dbSNP rsID,
* however, then you rely on the DB to be up-to-date and annotated
* correctly, which is not always the case. It's better to query
* variants by chromosomal coordinates. Original code is commented
* out below. */
for (PGXMarker pgxm : PGXDBFunctions.getMarkerInfo(g)) {
ComboCondition variantCondition= new ComboCondition(ComboCondition.Op.AND);
variantCondition.addCondition(
BinaryCondition.equalTo(ts.getDBColumn(BasicVariantColumns.CHROM), pgxm.chromosome));
variantCondition.addCondition(
BinaryCondition.equalTo(ts.getDBColumn(BasicVariantColumns.START_POSITION), Integer.parseInt(pgxm.position)));
query.addCondition(variantCondition);
}
} catch (Exception e) {
e.printStackTrace();
}
// add this gene-query pair to the list
queryMap.put(g, query);
}
return queryMap;
}
示例3: buildNovelConditionList
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
/**
* Build the standard pharmacogenomic conditions for NOVEL variants.
* @return a List of Conditions to be used for all PGx analyses of novel variants
* @throws SQLException
*/
private static List<Condition> buildNovelConditionList() throws SQLException, RemoteException, SessionExpiredException {
List<Condition> output= new LinkedList<Condition>();
/* Get all genic non-synonymous variants. */
ComboCondition mutationCondition= new ComboCondition(ComboCondition.Op.OR);
for (String mutationEffect : NOVEL_MUTATIONS) {
mutationCondition.addCondition(
BinaryCondition.iLike(ts.getDBColumn(BasicVariantColumns.JANNOVAR_EFFECT), mutationEffect + "%"));
}
output.add(mutationCondition);
/* For each of the allele frequency columns, check if the allele
* frequency is below threshold. If allele frequency at the position
* is null, also report it. */
ComboCondition afCondition= new ComboCondition(ComboCondition.Op.OR);
AnnotationManagerAdapter am= MedSavantClient.AnnotationManagerAdapter;
Map<String, Set<CustomField>> fieldMap=
am.getAnnotationFieldsByTag(LoginController.getInstance().getSessionID(), true);
Set<CustomField> columnNames= fieldMap.get(CustomField.ALLELE_FREQUENCY_TAG);
for (CustomField cf : columnNames) {
DbColumn afColumn= ts.getDBColumn(cf.getColumnName());
// include variant if AF is below threshold
afCondition.addCondition(
BinaryCondition.lessThan(afColumn, AF_THRESHOLD, true));
// include variant even if AF information is missing
afCondition.addCondition(UnaryCondition.isNull(afColumn));
}
output.add(afCondition);
return output;
}
示例4: queryVariants
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
/**
* Get all pharmacogenomic variants for this individual.
*/
private void queryVariants() throws SQLException, RemoteException, SessionExpiredException {
/* Iterate through all gene conditions. */
List<String> allGeneKeys= new ArrayList<String>(standardPGXConditions.keySet());
// Sort the list of genes by gene symbol for convenience later
Collections.sort(allGeneKeys);
for (String geneKey : allGeneKeys) {
/* The variants for this gene. */
PGXGene pgxVariants= new PGXGene(geneKey);
/* Take the standard combocondition and AND it to the DNA ID for this
* individual before submitting for variants. */
ComboCondition query= new ComboCondition(ComboCondition.Op.AND);
query.addCondition(
BinaryCondition.equalTo(ts.getDBColumn(BasicVariantColumns.DNA_ID), dnaID));
query.addCondition(standardPGXConditions.get(geneKey));
/* Once query is built, run it on the remote server. */
List<Variant> retrievedVariants= runRemoteQuery(query);
/* Add variants to the list for this PGx gene. */
for (Variant var : retrievedVariants) {
pgxVariants.addVariant(var);
}
/* Add the current gene-variant object to the list. */
pgxGenes.add(pgxVariants);
/* If analysis has been cancelled, stop querying. */
if (isCancelled) {
return;
}
}
}
示例5: applyFilters
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
private void applyFilters(SelectQuery query) {
if(this.filters != null && this.filters.length > 0) {
ComboCondition comboCondition = new ComboCondition(ComboCondition.Op.AND);
if (filters.length > 0) {
for(int i=0; i<filters.length; i++) {
Filter filter = filters[i];
FilterType filterType = filter.getFilterType();
DbColumn filterColumn = new DbColumn(dbTable, filter.getField(), "",null,null);
if(filterType.equals(FilterType.EQ)) {
comboCondition.addCondition(BinaryCondition.equalTo(filterColumn, filter.getValue()));
} else if(filterType.equals(FilterType.GT)) {
comboCondition.addCondition(BinaryCondition.greaterThan(filterColumn, filter.getValue(), false));
} else if(filterType.equals(FilterType.LT)) {
comboCondition.addCondition(BinaryCondition.lessThan(filterColumn, filter.getValue(), false));
} else if(filterType.equals(FilterType.GTE)) {
comboCondition.addCondition(BinaryCondition.greaterThan(filterColumn, filter.getValue(), true));
} else if(filterType.equals(FilterType.LTE)) {
comboCondition.addCondition(BinaryCondition.lessThan(filterColumn, filter.getValue(), true));
} else if(filterType.equals(FilterType.NEQ)) {
comboCondition.addCondition(BinaryCondition.notEqualTo(filterColumn, filter.getValue()));
} else if(filterType.equals(FilterType.IN)) {
ComboCondition comboConditionOR = new ComboCondition(ComboCondition.Op.OR);
String[] condicion =filter.getValue().toString().split(",");
for (int z=0; z < condicion.length ; z++) {
comboConditionOR.addCondition(BinaryCondition.equalTo(filterColumn, condicion[z]));
}
comboCondition.addCondition(comboConditionOR);
}
else {
throw new UnsupportedOperationException("Currently, the filter operation " + filterType + " is not supported");
}
}
}
query.addCondition(comboCondition);
}
}
示例6: getNovelVariants
import com.healthmarketscience.sqlbuilder.ComboCondition; //导入方法依赖的package包/类
/**
* Get all novel and rare pharmacogenomic variants for this individual.
* @precondition pgxGenes must already have been initialized by running queryVariants()
*/
private void getNovelVariants() throws SQLException, RemoteException, SessionExpiredException, PGXException {
/* If analysis has been cancelled, stop. */
if (isCancelled) {
return;
}
/* Iterate through all previously stored PGXGene objects and get all
* low allele frequency variants for these genes. */
for (PGXGene pg : pgxGenes) {
String geneSymbol= pg.getGene();
List<PGXMarker> existingMarkers= PGXDBFunctions.getMarkerInfo(geneSymbol);
ComboCondition query= new ComboCondition(ComboCondition.Op.AND);
/* Get variants for this patient/DNA ID and this PGx gene. */
query.addCondition(
BinaryCondition.equalTo(ts.getDBColumn(BasicVariantColumns.DNA_ID), dnaID));
query.addCondition(
BinaryCondition.iLike(ts.getDBColumn(BasicVariantColumns.JANNOVAR_SYMBOL), geneSymbol + "%"));
/* Ensure that the patient actually has this variant, and is not
* homozygous for the reference. This is important if reference
* positions are reported, which happens in a pgx analysis. In
* general, VCF files do not report homozygous ref positions. */
query.addCondition(
BinaryCondition.notiLike(ts.getDBColumn(BasicVariantColumns.GT), "0%0"));
/* Add all default novel Conditions to this query. */
for (Condition c : novelPGXConditions) {
query.addCondition(c);
}
/* Once query is built, run it on the remote server. */
List<Variant> potentialNovelVariants= runRemoteQuery(query);
/* Check if returned variants are NOT PGx markers and then add to
* the novel variants. */
for (Variant var : potentialNovelVariants) {
if (!isKnownPGXMarker(var.getChromosome(), Long.toString(var.getStart()))) {
pg.addNovelVariant(var);
}
}
}
}