public class SequenceFactory
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
appendDecoySequences(java.io.File destinationFile)
Appends decoy sequences to the desired file.
|
void |
appendDecoySequences(java.io.File destinationFile,
WaitingHandler waitingHandler)
Appends decoy sequences to the desired file while displaying progress.
|
void |
clearFactory()
Clears the factory getInstance() needs to be called afterwards.
|
void |
closeFile()
Closes the opened file.
|
double |
computeMolecularWeight(java.lang.String accession)
Returns the protein's molecular weight.
|
boolean |
concatenatedTargetDecoy()
Indicates whether the database loaded contains decoy sequences.
|
void |
emptyCache()
Empties the cache of the factory.
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
getAAOccurrences(javax.swing.JProgressBar progressBar)
Returns the occurrence of every amino acid in the database.
|
java.util.ArrayList<java.lang.String> |
getAccessions()
Returns the sequences present in the database.
|
Header |
getHeader(java.lang.String accession)
Returns the desired header for the protein in the FASTA file.
|
static SequenceFactory |
getInstance()
Static method returning the instance of the factory.
|
static SequenceFactory |
getInstance(int nCache)
Returns the instance of the factory with the specified cache size.
|
int |
getnCache()
Returns the size of the cache.
|
int |
getNTargetSequences()
Returns the number of target sequences in the database.
|
Protein |
getProtein(java.lang.String accession)
Returns the desired protein.
|
static boolean |
isDecoy(java.lang.String proteinAccession)
Returns a boolean indicating whether a protein is decoy or not based on
the protein accession.
|
void |
loadFastaFile(java.io.File fastaFile)
Loads a new FASTA file in the factory.
|
void |
loadFastaFile(java.io.File fastaFile,
WaitingHandler waitingHandler)
Loads a new FASTA file in the factory.
|
void |
setnCache(int nCache)
Sets the size of the cache.
|
public static SequenceFactory getInstance()
public static SequenceFactory getInstance(int nCache)
nCache
- the new cache sizepublic void clearFactory()
public void emptyCache()
public Protein getProtein(java.lang.String accession) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
accession
- accession of the desired proteinjava.io.IOException
- thrown whenever an error is encountered while reading
the FASTA filejava.lang.IllegalArgumentException
- thrown whenever an error is encountered
while reading the FASTA filejava.lang.InterruptedException
public Header getHeader(java.lang.String accession) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
accession
- accession of the desired proteinjava.io.IOException
- exception thrown whenever an error occurred while
reading the FASTA filejava.lang.IllegalArgumentException
- exception thrown whenever a protein is
not foundjava.lang.InterruptedException
public void loadFastaFile(java.io.File fastaFile) throws java.io.FileNotFoundException, java.io.IOException, java.lang.ClassNotFoundException
fastaFile
- the FASTA file to loadjava.io.FileNotFoundException
- exception thrown if the file was not foundjava.io.IOException
- exception thrown if an error occurred while reading
the FASTA filejava.lang.ClassNotFoundException
- exception thrown whenever an error
occurred while deserializing the file indexpublic void loadFastaFile(java.io.File fastaFile, WaitingHandler waitingHandler) throws java.io.FileNotFoundException, java.io.IOException, java.lang.ClassNotFoundException, java.lang.StringIndexOutOfBoundsException, java.lang.IllegalArgumentException
fastaFile
- the FASTA file to loadwaitingHandler
- a waitingHandler showing the progressjava.io.FileNotFoundException
- exception thrown if the file was not foundjava.io.IOException
- exception thrown if an error occurred while reading
the FASTA filejava.lang.ClassNotFoundException
- exception thrown whenever an error
occurred while deserializing the file indexjava.lang.StringIndexOutOfBoundsException
- thrown if issues occur during the
parsing of the protein headersjava.lang.IllegalArgumentException
- if non unique accession numbers are
foundpublic void closeFile() throws java.io.IOException
java.io.IOException
- exception thrown whenever an error occurred while
closing the filepublic static boolean isDecoy(java.lang.String proteinAccession)
proteinAccession
- The accession of the proteinpublic boolean concatenatedTargetDecoy()
public int getNTargetSequences()
public void appendDecoySequences(java.io.File destinationFile) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException, java.io.FileNotFoundException, java.lang.ClassNotFoundException
destinationFile
- the destination filejava.io.IOException
- exception thrown whenever an error occurred while
reading or writing a filejava.lang.IllegalArgumentException
java.lang.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public void appendDecoySequences(java.io.File destinationFile, WaitingHandler waitingHandler) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException, java.io.FileNotFoundException, java.lang.ClassNotFoundException
destinationFile
- the destination filewaitingHandler
- the waiting handlerjava.io.IOException
- exception thrown whenever an error occurred while
reading or writing a filejava.lang.IllegalArgumentException
- exception thrown whenever a protein is
not foundjava.lang.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public java.util.ArrayList<java.lang.String> getAccessions()
public int getnCache()
public void setnCache(int nCache)
nCache
- the new size of the cachepublic java.util.HashMap<java.lang.String,java.lang.Integer> getAAOccurrences(javax.swing.JProgressBar progressBar) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
progressBar
- a progress bar, can be nulljava.io.IOException
- exception thrown whenever an error occurred while
reading the databasejava.lang.IllegalArgumentException
java.lang.InterruptedException
public double computeMolecularWeight(java.lang.String accession) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
accession
- the protein's accession numberjava.io.IOException
java.lang.IllegalArgumentException
java.lang.InterruptedException
Copyright © 2013. All Rights Reserved.