Package org.snpeff.geneSets

# Class GeneSets

java.lang.Object
org.snpeff.geneSets.GeneSets

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

Direct Known Subclasses:
  `GeneSetsRanked`

public class GeneSets extends Object implements Iterable<GeneSet>, Serializable
A collection of GeneSets Genes have associated "experimental values"

Author:
  Pablo Cingolani
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static boolean`
`debug`
`static double`
`LOG2`
`static long`
`PRINT_SOMETHING_TIME`

## Constructor Summary

Constructors
Constructor
Description
`GeneSets()`
Default constructor
`GeneSets(String msigDb)`
`GeneSets(GeneSets geneSets)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`add(String gene)`
Add a gene and aliases
`boolean`
`add(String gene, GeneSet geneSet)`
Add a gene and it's corresponding gene set
`void`
`add(GeneSet geneSet)`
Add a gene set
`boolean`
`addInteresting(String gene)`
Add a symbol as 'interesting' gene (to every corresponding GeneSet in this collection)
`void`
`checkInterestingGenes(Set<String> intGenes)`
Checks that every symboolID is in the set (as 'interesting' genes)
`protected void`
`copy(GeneSets geneSets)`
Copy all data from geneSets
`GeneSet`
`disjointSet(List<GeneSet> geneSetList, int activeSets)`
Produce a GeneSet based on a list of GeneSets and a 'mask'
`static GeneSets`
`factory(GoTerms goTerms)`
Create gene sets form GoTerms
`List<GeneSet>`
`geneSetsSorted()`
Iterate through each GeneSet in this GeneSets
`List<GeneSet>`
`geneSetsSortedSize(boolean reverse)`
Gene sets sorted by size (if same size, sort by name).
`int`
`getGeneCount()`
How many genes do we have?
`Set<String>`
`getGenes()`
Get all genes in this set
`GeneSet`
`getGeneSet(String geneSetName)`
Get a gene set named 'geneSetName'
`int`
`getGeneSetCount()`
Get number of gene sets
`HashSet<GeneSet>`
`getGeneSetsByGene(String gene)`
All gene sets that this gene belongs to
`HashMap<String,GeneSet>`
`getGeneSetsByName()`
`HashSet<String>`
`getInterestingGenes()`
`int`
`getInterestingGenesCount()`
`String`
`getLabel()`
`double`
`getValue(String gene)`
Get experimental value
`HashMap<String,Double>`
`getValueByGene()`
`boolean`
`hasGene(String geneId)`
`boolean`
`hasValue(String gene)`
`boolean`
`isInteresting(String geneName)`
`boolean`
`isRanked()`
`protected boolean`
`isUsed(String geneName)`
`protected boolean`
`isUsed(GeneSet gs)`
Is this gene set used? I.e.
`Iterator<GeneSet>`
`iterator()`
Iterate through each GeneSet in this GeneSets
`Iterator<GeneSet>`
`iteratorSorted()`
Iterate through each GeneSet in this GeneSets
`Set<String>`
`keySet()`
`List<GeneSet>`
`listTopTerms(int numberToSelect)`
Select a number of GeneSets
`List<String>`
`loadExperimentalValues(String fileName, boolean maskException)`
Reads a file with a list of genes and experimental values.
`boolean`
`loadMSigDb(String gmtFile, boolean maskException)`
Read an MSigDBfile and add every Gene set (do not add relationships between nodes in DAG)
`void`
`remove(GeneSet geneSet)`
`void`
`removeGeneSet(String geneSetName)`
Remove a GeneSet
`void`
`removeUnusedSets()`
Remove unused gene sets
`void`
`reset()`
Reset every 'interesting' gene or ranked gene (on every single GeneSet in this GeneSets)
`void`
`saveGseaGeneSets(String fileName)`
Save gene sets file for GSEA analysis Format specification: http://www.broad.mit.edu/cancer/software/gsea/wiki/index.php/Data_formats#GMT:_Gene_Matrix_Transposed_file_format_.28.2A.gmt.29
`void`
`setDoNotAddIfNotInGeneSet(boolean doNotAddIfNotInGeneSet)`
`void`
`setGeneSetByName(HashMap<String,GeneSet> geneSets)`
`void`
`setInterestingGenes(HashSet<String> interestingGenesIdSet)`
`void`
`setValue(String geneId, double value)`
Set experimental value for this gene
`void`
`setVerbose(boolean verbose)`
`String`
`toString()`
`Collection<GeneSet>`
`values()`

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### debug

public static boolean debug

### LOG2

public static double LOG2

### PRINT_SOMETHING_TIME

public static long PRINT_SOMETHING_TIME

## Constructor Details

### GeneSets

public GeneSets()
Default constructor

### GeneSets

public GeneSets(GeneSets geneSets)

### GeneSets

public GeneSets(String msigDb)

## Method Details

### factory

public static GeneSets factory(GoTerms goTerms)
Create gene sets form GoTerms

Parameters:
  `goTerms` - : GoTerms to use

### add

public void add(GeneSet geneSet)
Add a gene set

Parameters:
  `geneSet` -
  `geneSetName` -

### add

public boolean add(String gene)
Add a gene and aliases

### add

public boolean add(String gene, GeneSet geneSet)
Add a gene and it's corresponding gene set

Parameters:
  `gene` -
  `geneSet` -
Returns:

### addInteresting

public boolean addInteresting(String gene)
Add a symbol as 'interesting' gene (to every corresponding GeneSet in this collection)

### checkInterestingGenes

public void checkInterestingGenes(Set<String> intGenes)
Checks that every symboolID is in the set (as 'interesting' genes)

Parameters:
  `intGenes` - : A set of interesting genes Throws an exception on error

### copy

protected void copy(GeneSets geneSets)
Copy all data from geneSets

Parameters:
  `geneSets` -

### disjointSet

public GeneSet disjointSet(List<GeneSet> geneSetList, int activeSets)
Produce a GeneSet based on a list of GeneSets and a 'mask'

Parameters:
  `geneSetList` - : A list of GeneSets
  `activeSets` - : An integer (binary mask) that specifies weather a set in the list should be taken into account or not. The operation performed is: Intersection{ GeneSets where mask_bit == 1 } - Union{ GeneSets where mask_bit == 0 } ) where the minus sign '-' is actually a 'set minus' operation. This operation is done for both sets in GeneSet (i.e. genes and interestingGenes)
Returns:
  A GeneSet

### geneSetsSorted

public List<GeneSet> geneSetsSorted()
Iterate through each GeneSet in this GeneSets

### geneSetsSortedSize

public List<GeneSet> geneSetsSortedSize(boolean reverse)
Gene sets sorted by size (if same size, sort by name).

Parameters:
  `reverse` - : Reverse size sorting (does not affect name sorting)
Returns:

### getGeneCount

public int getGeneCount()
How many genes do we have?

Returns:

### getGenes

public Set<String> getGenes()
Get all genes in this set

Returns:

### getGeneSet

public GeneSet getGeneSet(String geneSetName)
Get a gene set named 'geneSetName'

Parameters:
  `geneSetName` -
Returns:

### getGeneSetCount

public int getGeneSetCount()
Get number of gene sets

Returns:

### getGeneSetsByGene

public HashSet<GeneSet> getGeneSetsByGene(String gene)
All gene sets that this gene belongs to

Parameters:
  `gene` -
Returns:

### getGeneSetsByName

public HashMap<String,GeneSet> getGeneSetsByName()

### getInterestingGenes

public HashSet<String> getInterestingGenes()

### getInterestingGenesCount

public int getInterestingGenesCount()

### getLabel

public String getLabel()

### getValue

public double getValue(String gene)
Get experimental value

Parameters:
  `gene` -
Returns:

### getValueByGene

public HashMap<String,Double> getValueByGene()

### hasGene

public boolean hasGene(String geneId)

### hasValue

public boolean hasValue(String gene)

### isInteresting

public boolean isInteresting(String geneName)

### isRanked

public boolean isRanked()

### isUsed

protected boolean isUsed(GeneSet gs)
Is this gene set used? I.e. is there at least one gene 'used'? (e.g. interesting or ranked)

Parameters:
  `gs` -
Returns:

### isUsed

protected boolean isUsed(String geneName)

### iterator

public Iterator<GeneSet> iterator()
Iterate through each GeneSet in this GeneSets

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

### iteratorSorted

public Iterator<GeneSet> iteratorSorted()
Iterate through each GeneSet in this GeneSets

### keySet

public Set<String> keySet()

### listTopTerms

public List<GeneSet> listTopTerms(int numberToSelect)
Select a number of GeneSets

Parameters:
  `numberToSelect` -
Returns:

### loadExperimentalValues

public List<String> loadExperimentalValues(String fileName, boolean maskException)
Reads a file with a list of genes and experimental values. Format: "gene \t value \n"

Parameters:
  `fileName` -
Returns:
  A list of genes not found

### loadMSigDb

public boolean loadMSigDb(String gmtFile, boolean maskException)
Read an MSigDBfile and add every Gene set (do not add relationships between nodes in DAG)

Parameters:
  `gmtFile` -
  `geneSetType` -

### remove

public void remove(GeneSet geneSet)

### removeGeneSet

public void removeGeneSet(String geneSetName)
Remove a GeneSet

### removeUnusedSets

public void removeUnusedSets()
Remove unused gene sets

### reset

public void reset()
Reset every 'interesting' gene or ranked gene (on every single GeneSet in this GeneSets)

### saveGseaGeneSets

public void saveGseaGeneSets(String fileName)
Save gene sets file for GSEA analysis Format specification: http://www.broad.mit.edu/cancer/software/gsea/wiki/index.php/Data_formats#GMT:_Gene_Matrix_Transposed_file_format_.28.2A.gmt.29

Parameters:
  `fileName` -

### setDoNotAddIfNotInGeneSet

public void setDoNotAddIfNotInGeneSet(boolean doNotAddIfNotInGeneSet)

### setGeneSetByName

public void setGeneSetByName(HashMap<String,GeneSet> geneSets)

### setInterestingGenes

public void setInterestingGenes(HashSet<String> interestingGenesIdSet)

### setValue

public void setValue(String geneId, double value)
Set experimental value for this gene

Parameters:
  `geneId` -
  `value` -

### setVerbose

public void setVerbose(boolean verbose)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### values

public Collection<GeneSet> values()