com.compomics.util.experiment.annotation.gene
Class GeneFactory

java.lang.Object
  extended by com.compomics.util.experiment.annotation.gene.GeneFactory

public class GeneFactory
extends Object

The gene factory provides gene information for protein accessions.

Author:
Marc Vaudel

Field Summary
static String separator
          The separator used to separate line contents.
 
Method Summary
 void clearFactory()
          Clears the mappings.
 void closeFiles()
          Closes files.
 String getChromosomeForGeneName(String geneName)
          Returns the chromosome for a given gene.
 String getChromosomeFromGeneId(String geneID)
          Returns the chromosome where a gene can be located, null if not found.
 String getChromosomeFromGeneName(String geneName)
          Returns the chromosome where a gene can be located, null if not found.
 String getGeneEnsemblId(String geneName)
          Returns the Ensembl ID of a gene, null if not found.
 String getGeneName(String geneID)
          Returns the name of a gene, null if not found.
 String getGeneNameForUniProtProtein(String proteinAccession)
          Returns the gene name attached to a protein.
static GeneFactory getInstance()
          Static method returning the instance of the factory.
 ArrayList<String> getMappedGeneNames()
          Returns a list of the mapped genes indexed by their gene names.
 ArrayList<String> getMappedGenes()
          Returns a list of the mapped genes indexed by their Ensembl Gene ID.
 void initialize(File file, WaitingHandler waitingHandler)
          Initializes the factory on the given file.
 boolean isMappingFileOpen()
          Returns true of the mapping file is currently open.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

separator

public static final String separator
The separator used to separate line contents.

See Also:
Constant Field Values
Method Detail

getInstance

public static GeneFactory getInstance()
Static method returning the instance of the factory.

Returns:
the instance of the factory

initialize

public void initialize(File file,
                       WaitingHandler waitingHandler)
                throws IOException
Initializes the factory on the given file. If gene IDs are duplicate only the last one will be retained.

Parameters:
file - the file containing the mapping
waitingHandler - a waiting handler allowing display of the progress and canceling of the process.
Throws:
IOException

getChromosomeForGeneName

public String getChromosomeForGeneName(String geneName)
Returns the chromosome for a given gene.

Parameters:
geneName - the gene name
Returns:
the chromosome for a given gene

getMappedGenes

public ArrayList<String> getMappedGenes()
Returns a list of the mapped genes indexed by their Ensembl Gene ID.

Returns:
a list of the mapped genes

getMappedGeneNames

public ArrayList<String> getMappedGeneNames()
Returns a list of the mapped genes indexed by their gene names.

Returns:
a list of the mapped genes

getGeneName

public String getGeneName(String geneID)
                   throws IOException
Returns the name of a gene, null if not found.

Parameters:
geneID - the Ensembl ID of the gene of interest
Returns:
the name of the gene
Throws:
IOException

getGeneEnsemblId

public String getGeneEnsemblId(String geneName)
                        throws IOException
Returns the Ensembl ID of a gene, null if not found.

Parameters:
geneName - the gene name of the gene of interest
Returns:
the Ensembl ID of the gene
Throws:
IOException

getChromosomeFromGeneId

public String getChromosomeFromGeneId(String geneID)
                               throws IOException
Returns the chromosome where a gene can be located, null if not found.

Parameters:
geneID - the Ensembl ID of the gene of interest
Returns:
the chromosome where the gene can be located
Throws:
IOException

getChromosomeFromGeneName

public String getChromosomeFromGeneName(String geneName)
                                 throws IOException
Returns the chromosome where a gene can be located, null if not found.

Parameters:
geneName - the gene name of the gene of interest
Returns:
the chromosome where the gene can be located
Throws:
IOException

getGeneNameForUniProtProtein

public String getGeneNameForUniProtProtein(String proteinAccession)
                                    throws IOException,
                                           IllegalArgumentException,
                                           InterruptedException,
                                           FileNotFoundException,
                                           ClassNotFoundException
Returns the gene name attached to a protein. Note, for now this is implemented only for UniProt sequences. The sequences must be imported in the SequenceFactory.

Parameters:
proteinAccession - the accession of the protein of interest
Returns:
the name of the gene, null if not found
Throws:
IOException
IllegalArgumentException
InterruptedException
FileNotFoundException
ClassNotFoundException - RE

closeFiles

public void closeFiles()
                throws IOException
Closes files.

Throws:
IOException

clearFactory

public void clearFactory()
Clears the mappings.


isMappingFileOpen

public boolean isMappingFileOpen()
Returns true of the mapping file is currently open.

Returns:
true of the mapping file is currently open


Copyright © 2013. All Rights Reserved.