# Class EnrichmentAlgorithmGreedy

java.lang.Object
org.snpeff.geneSets.algorithm.EnrichmentAlgorithm
org.snpeff.geneSets.algorithm.EnrichmentAlgorithmGreedy

Direct Known Subclasses:
  `EnrichmentAlgorithmGreedyVariableSize`

public abstract class EnrichmentAlgorithmGreedy extends EnrichmentAlgorithm
A generic greedy enrichment algorithm for selecting gene-sets

Author:
  pcingola

## Nested Class Summary

### Nested classes/interfaces inherited from class EnrichmentAlgorithm

`EnrichmentAlgorithm.EnrichmentAlgorithmType`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`adjustedPvalue`
`static final double`
`DEFAULT_MAX_PVALUE`
`protected double`
`maxPvalue`
`protected double`
`maxPvalueAjusted`

### Fields inherited from class EnrichmentAlgorithm

`HTML_BG_COLOR, HTML_BG_COLOR_TITLE, HTML_TD_GENES_MAX_LEN, PRINT_SOMETHING_TIME`

## Constructor Summary

Constructors
Constructor
Description
`EnrichmentAlgorithmGreedy(GeneSets geneSets, int numberToSelect)`

## Method Summary

Modifier and Type
Method
Description
`protected Result`
`greedyPvalue(Result prevResult)`
Calculate best list of terms by adding a new term to a list that minimize p-value (rank sum)
`protected Result`
`greedyPvalue(Result prevResult, int minGeneSetSize, int maxGeneSetSize)`
Calculate best list of terms by adding a new term to a list that minimize p-value (rank sum) Only look for genesets within [minGeneSetSize, maxGeneSetSize] size range
`Result`
`select()`
Select the 'best' gene sets
`void`
`setAdjustedPvalue(boolean adjustedPvalue)`
`void`
`setMaxGeneSetSize(int maxGeneSetSize)`
`void`
`setMaxPvalue(double maxPvalue)`
`void`
`setMaxPvalueAjusted(double maxPvalueAjusted)`
`void`
`setMinGeneSetSize(int minGeneSetSize)`
`void`
`setVerbose(boolean verbose)`
`protected boolean`
`stopCriteria(Result result)`
Stop criteria

### Methods inherited from class EnrichmentAlgorithm

`getMaxPvalueAdjusted, getOutput, isShow, print, setDebug, setFilterOutputGeneSets, setHtmlTable, setMaxPValue, setMaxPvalueAdjusted`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_MAX_PVALUE

public static final double DEFAULT_MAX_PVALUE

See Also:
  - Constant Field Values

### adjustedPvalue

protected boolean adjustedPvalue

### maxPvalue

protected double maxPvalue

### maxPvalueAjusted

protected double maxPvalueAjusted

## Constructor Details

### EnrichmentAlgorithmGreedy

public EnrichmentAlgorithmGreedy(GeneSets geneSets, int numberToSelect)

## Method Details

### greedyPvalue

protected Result greedyPvalue(Result prevResult)
Calculate best list of terms by adding a new term to a list that minimize p-value (rank sum)

Returns:

### greedyPvalue

protected Result greedyPvalue(Result prevResult, int minGeneSetSize, int maxGeneSetSize)
Calculate best list of terms by adding a new term to a list that minimize p-value (rank sum) Only look for genesets within [minGeneSetSize, maxGeneSetSize] size range

Returns:

### select

public Result select()
Select the 'best' gene sets

Overrides:
  `select` in class `EnrichmentAlgorithm`
Returns:

### setAdjustedPvalue

public void setAdjustedPvalue(boolean adjustedPvalue)

### setMaxGeneSetSize

public void setMaxGeneSetSize(int maxGeneSetSize)

Overrides:
  `setMaxGeneSetSize` in class `EnrichmentAlgorithm`

### setMaxPvalue

public void setMaxPvalue(double maxPvalue)

### setMaxPvalueAjusted

public void setMaxPvalueAjusted(double maxPvalueAjusted)

### setMinGeneSetSize

public void setMinGeneSetSize(int minGeneSetSize)

Overrides:
  `setMinGeneSetSize` in class `EnrichmentAlgorithm`

### setVerbose

public void setVerbose(boolean verbose)

Overrides:
  `setVerbose` in class `EnrichmentAlgorithm`

### stopCriteria

protected boolean stopCriteria(Result result)
Stop criteria

Parameters:
  `result` -
Returns:
  true if stop criteria has been met and algorithm should stop iterating.