# Class GeneSet

java.lang.Object
org.snpeff.geneSets.GeneSet

All Implemented Interfaces:
  `Serializable, Comparable<GeneSet>, Iterable<String>`

public class GeneSet extends Object implements Comparable<GeneSet>, Iterable<String>, Serializable
An set of genes (that belongs to a collection of gene-sets)

Author:
  Pablo Cingolani
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static boolean`
`debug`

## Constructor Summary

Constructors
Constructor
Description
`GeneSet(String name, String description, GeneSets geneSets)`
Create an empty gene set (that belongs to a collection of gene sets 'geneSets')
`GeneSet(List<GeneSet> geneSetList, GeneSets geneSets)`
Create a new GeneSet by joining all GeneSets in the list

## Method Summary

Modifier and Type
Method
Description
`void`
`addGene(String gene)`
Add one gene to genesSet
`int`
`compareTo(GeneSet geneSet)`
Comparable interface (to order terms)
`int`
`compareToNumbers(double n1, double n2, String name1, String name2, boolean descending)`
Compare 2 numbers and 2 'names' (if both numbers are equal) - NaN sorted in a way that they remain at the end of a sorted list - When two numbers are equal, the sort is done alphabetically by name
`int`
`countOverlap(GeneSet gs)`
COunt how many genes are in both GeneSets
`List<String>`
`genesSorted()`
Return a sorted list of genes
`String`
`getDescription()`
`int`
`getGeneCount()`
Number of symbols in this node (total = interesting + not-interesting)
`HashSet<String>`
`getGenes()`
`GeneSets`
`getGeneSets()`
`HashSet<String>`
`getInterestingGenes()`
Get 'interesting' genes
`int`
`getInterestingGenesCount()`
Number of 'interesting' symbols
`int`
`getMaxRank()`
`String`
`getName()`
`int`
`getRankedGenesCount()`
`long`
`getRankSum()`
`boolean`
`hasGene(String gene)`
`void`
`intersection(GeneSet geneSet)`
Intersects this term with 'geneSet' (intersects 'geneSet' and 'interestingGeneSet').
`Iterator<String>`
`iterator()`
`long`
`rankSum()`
Calculate rankSum, rankedSymbols and maxRank
`void`
`setDescription(String description)`
`void`
`setGeneSets(GeneSets geneSets)`
`void`
`setMaxRank(int maxRank)`
`void`
`setMinus(GeneSet geneSet)`
Perform a 'set minus' between this term and 'geneSet' (set minus for 'geneSet' and 'interestingGeneSet').
`void`
`setName(String geneSetName)`
`int`
`size()`
`int`
`sizeEffective()`
Number of genes that have a value
`String`
`toString()`
`String`
`toStringAll()`
`void`
`union(GeneSet geneSet)`
Union this term with 'geneSet' (union for 'geneSet' and 'interestingGeneSet').

### Methods inherited from class Object

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

### Methods inherited from interface Iterable

`forEach, spliterator`

## Field Details

### debug

public static boolean debug

## Constructor Details

### GeneSet

public GeneSet(List<GeneSet> geneSetList, GeneSets geneSets)
Create a new GeneSet by joining all GeneSets in the list

Parameters:
  `geneSetList` -

### GeneSet

public GeneSet(String name, String description, GeneSets geneSets)
Create an empty gene set (that belongs to a collection of gene sets 'geneSets')

Parameters:
  `name` -
  `geneSets` -

## Method Details

### addGene

public void addGene(String gene)
Add one gene to genesSet

Parameters:
  `gene` -

### compareTo

public int compareTo(GeneSet geneSet)
Comparable interface (to order terms)

Specified by:
  `compareTo` in interface `Comparable<GeneSet>`

### compareToNumbers

public int compareToNumbers(double n1, double n2, String name1, String name2, boolean descending)
Compare 2 numbers and 2 'names' (if both numbers are equal) - NaN sorted in a way that they remain at the end of a sorted list - When two numbers are equal, the sort is done alphabetically by name

Parameters:
  `n1` -
  `n2` -
  `name1` -
  `name2` -
Returns:

### countOverlap

public int countOverlap(GeneSet gs)
COunt how many genes are in both GeneSets

Parameters:
  `gs` -
Returns:

### genesSorted

public List<String> genesSorted()
Return a sorted list of genes

Returns:

### getDescription

public String getDescription()

### getGeneCount

public int getGeneCount()
Number of symbols in this node (total = interesting + not-interesting)

Returns:

### getGenes

public HashSet<String> getGenes()

### getGeneSets

public GeneSets getGeneSets()

### getInterestingGenes

public HashSet<String> getInterestingGenes()
Get 'interesting' genes

Returns:

### getInterestingGenesCount

public int getInterestingGenesCount()
Number of 'interesting' symbols

Returns:

### getMaxRank

public int getMaxRank()

### getName

public String getName()

### getRankedGenesCount

public int getRankedGenesCount()

### getRankSum

public long getRankSum()

### hasGene

public boolean hasGene(String gene)

### intersection

public void intersection(GeneSet geneSet)
Intersects this term with 'geneSet' (intersects 'geneSet' and 'interestingGeneSet').

Parameters:
  `geneSet` - : GeneSet to intercept

### iterator

public Iterator<String> iterator()

Specified by:
  `iterator` in interface `Iterable<String>`

### rankSum

public long rankSum()
Calculate rankSum, rankedSymbols and maxRank

Returns:
  rankSum

### setDescription

public void setDescription(String description)

### setGeneSets

public void setGeneSets(GeneSets geneSets)

### setMaxRank

public void setMaxRank(int maxRank)

### setMinus

public void setMinus(GeneSet geneSet)
Perform a 'set minus' between this term and 'geneSet' (set minus for 'geneSet' and 'interestingGeneSet').

Parameters:
  `geneSet` - : GeneSet to use for 'set minus' operation

### setName

public void setName(String geneSetName)

### size

public int size()

### sizeEffective

public int sizeEffective()
Number of genes that have a value

Returns:

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### toStringAll

public String toStringAll()

### union

public void union(GeneSet geneSet)
Union this term with 'geneSet' (union for 'geneSet' and 'interestingGeneSet').

Parameters:
  `geneSet` - : GeneSet to use for union